Tryton - Issues

 

Issue7773

Title FEC and PieceDate for non-invoice lines should be the line date and not the post_date
Priority bug Status resolved
Superseder Nosy List ced, reviewbot, risto3, roundup-bot, semarie
Type behavior Components account_fr
Assigned To ced Keywords review
Reviews 58411002
View: 58411002

Created on 2018-10-08.08:37:06 by risto3, last changed by roundup-bot.

Messages
New changeset 381c278cb923 by Cédric Krier in branch 'default':
Use move date in reference date for PieceDate
https://hg.tryton.org/tryton-env/rev/381c278cb923
New changeset 475a873291a7 by Cédric Krier in branch 'default':
Use move date in reference date for PieceDate
https://hg.tryton.org/modules/account_fr/rev/475a873291a7
review58411002 updated at https://codereview.tryton.org/58411002/#ps1
msg44734 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-11-02.22:13:17
I agree that move date correspond better to the definition than the post date when there is no reference document. Here is review58411002
msg44365 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-10-08.15:18:03
line.date is actually the move.date and this date must always be inside the period range.
But there are no constraint on the invoice that the accounting date (used as move.date) > invoice date (used as reference date). And I think we should not enforce it. We can receive a supplier invoice at a date and want to book it at a date before.
msg44364 (view) Author: [hidden] (semarie) Date: 2018-10-08.13:50:31
> Currently, the function get_reference_date() returns the post_date (ValidDate) for non invoice move lines,
> which breaks the chronology as ValidDate is always greater than or equal to EcritureDate

I am not sure to correctly understand the problem: in the definition, EcritureDate <= ValidDate is fine.

Eventually, it could be a problem if the Move is posted after the end of fiscal year. PieceDate value would have the post_date value, and it could be outside the fiscal year.

But I am unsure if the right value to use is line.date or line.move.date (what we already use for EcritureDate)
msg44354 (view) Author: [hidden] (risto3) Date: 2018-10-08.10:06:32
extract in French...

Pour information :
- Le champ dans le FEC "PieceDate" devrait contenir la date de la pièce justificative et devrait correspondre à la date à laquelle le justificatif est enregistré en comptabilité ou à la date figurant sur la pièce justificative reçue ou émise (se reporter au BOI-CF-IOR-60-40-20 n°190)

[BOI-CF-IOR-60-40-20 n°190]
La date de la pièce justificative est celle figurant sur les pièces justificatives (factures, tickets, etc.) reçues ou émises ou, à défaut, leur date d’enregistrement en comptabilité.

Dans le cas des écritures pour lesquelles il n’existe pas de référence de pièce (par exemple, dans le cas des écritures d’à nouveau), ce champ « date » doit néanmoins être rempli. Dans ce cas précis, la référence sera alors remplacée par une date conventionnelle définie par l’entreprise. Celle-ci sera précisée dans le descriptif remis au vérificateur en même temps que le fichier des écritures comptables (cf. VI § 390).
msg44353 (view) Author: [hidden] (risto3) Date: 2018-10-08.08:37:05
Using veryfec I notice the following [for some] non-invoice move lines:
EDP
	Les dates de PieceDate sont dans l'exercice  	Les dates du champ PieceDate sont dans l'exercice
Les dates du champ PieceDate sont comprises entre le 1/01/2017 et le 31/12/2017

Apparently this is tested by numerous validation suites:
"Vérifier la cohérence des différentes dates mentionnées dans chaque ligne d’écriture comptable :

Objectif du contrôle 
Appartenance à l’exercice pour PieceDate et EcritureDate
Respect de la chronologie
o PieceDate <= EcritureDate <= ValidDate
o DateLet >= PieceDate et EcritureDate
Cohérence de la validation : ValidDate <= Fin d’exercice + 4mois

Les différentes dates et leur chronologie sont définies par le PCG aux articles 921 et 922.

Currently, the function get_reference_date() returns the post_date (ValidDate) for non invoice move lines,
which breaks the chronology as ValidDate is always greater than or equal to EcritureDate

The following patch resolves this for me:
--- account.py  2018-10-07 13:19:56.982571109 +0200                                                                                                                                                  
+++ /opt/trytond/trytond/modules/account_fr/account.py  2018-10-08 08:04:44.328038060 +0200                                                                                                          
@@ -320,7 +320,7 @@ class AccountFrFEC(Wizard):                                                                                                                                                      
             Invoice = None                                                                                                                                                                          
         if Invoice and isinstance(line.move.origin, Invoice):                                                                                                                                       
             return line.move.origin.invoice_date                                                                                                                                                    
-        return line.move.post_date                                                                                                                                                                  
+        return line.date                                                                                                                                                                       
                                                                                                                                                                                                     
                                                                                                                                                                                                     
 class AccountFrFECStart(ModelView):
History
Date User Action Args
2018-11-18 12:04:01roundup-botsetmessages: + msg44905
2018-11-18 12:03:55roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg44904
2018-11-02 22:28:43reviewbotsetnosy: + reviewbot
messages: + msg44735
2018-11-02 22:13:17cedsetstatus: chatting -> testing
keyword: + review
messages: + msg44734
reviews: 58411002
assignedto: ced
type: behavior
2018-10-08 15:18:03cedsetnosy: + ced
messages: + msg44365
2018-10-08 13:50:31semariesetnosy: + semarie
messages: + msg44364
2018-10-08 10:06:32risto3setstatus: unread -> chatting
messages: + msg44354
2018-10-08 08:37:06risto3create

Showing 10 items. Show all history (warning: this could be VERY long)