Tryton - Issues

 

Issue7425

Title FEC should ignore move lines where debit == credit == 0
Priority bug Status resolved
Superseder Nosy List ced, reviewbot, risto3, roundup-bot
Type behavior Components account_fr
Assigned To ced Keywords review
Reviews 72311002
View: 72311002

Created on 2018-05-10.08:49:59 by risto3, last changed by roundup-bot.

Messages
New changeset 8c5ee02ed70a by Cédric Krier in branch 'default':
Skip line with debit and credit equals to zero in FEC
https://hg.tryton.org/tryton-env/rev/8c5ee02ed70a
New changeset 5a33f04ac673 by Cédric Krier in branch 'default':
Skip line with debit and credit equals to zero in FEC
https://hg.tryton.org/modules/account_fr/rev/5a33f04ac673
msg43842 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-09-12.14:24:21
There is no need for comment because anyone who knows the feature of the domain know that it is the only way to write it.
msg43841 (view) Author: [hidden] (risto3) Date: 2018-09-12.13:59:14
BTW, perhaps '('debit', '!=', 'credit')' is even simpler given at least one side *must* be zéro...  that is: 'WHERE debit != credit'

a simple comment can explain the reasoning
msg43840 (view) Author: [hidden] (risto3) Date: 2018-09-12.13:44:43
let's just say I was not paying enough attention when I looked at that...
'WHERE debit!=0 OR credit!=0' is probably even a cheaper operation...

I'm awaiting feedback as to an official position whether these null move lines (among other issues) are actually valid in the first place and, if so, is it truly acceptable to prune them out for the FEC generation.

Hopefully I'll have a response soon, so please don't push yet.
msg43838 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-09-12.13:07:45
It does but not this form as Tryton does not have NOT.
msg43817 (view) Author: [hidden] (risto3) Date: 2018-09-11.18:40:26
I'll give the review patchset a try, but by inspection I wonder whether the 'OR' clause used really generates something like the 'WHERE NOT ( debit = 0 AND credit = 0)' needed?

         return Line.search([
                 ('move.period.fiscalyear', '=', self.start.fiscalyear.id),
                 ('move.state', '=', 'posted'),
+                ['OR', ('debit', '!=', 0), ('credit', '!=', 0)],
                 ],
review72311002 updated at https://codereview.tryton.org/72311002/#ps20001
msg40608 (view) Author: [hidden] (risto3) Date: 2018-05-10.08:49:58
running Test-Compta-Demat I noticed the following observations in the test report:
Les anomalies suivantes figurent dans le fichier
o Structure fichier incorrecte, débit/crédit ... renseignés sur une même ligne ... , ou débit=crédit=0
[7] fois dans le fichier

Checking the file, I could confirm seeing lines where débit == crédit == 0

The following patch in account_fr seems to fix this issue:

diff -r 0a79f2a6089d account.py
--- a/account.py        Mon Apr 23 17:43:24 2018 +0200
+++ b/account.py        Thu May 10 08:40:33 2018 +0200
@@ -117,6 +117,8 @@
         for row in self.get_start_balance():
             writer.writerow(map(convert, row))
         for line in self.get_lines():
+            if not line.debit and not line.credit:
+                continue
             row = self.get_row(line, format_date, format_number)
             writer.writerow(map(convert, row))
         value = fec.getvalue()
History
Date User Action Args
2018-09-17 17:45:21roundup-botsetmessages: + msg43917
2018-09-17 17:45:16roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg43916
2018-09-12 14:24:21cedsetmessages: + msg43842
2018-09-12 13:59:15risto3setmessages: + msg43841
2018-09-12 13:44:44risto3setmessages: + msg43840
2018-09-12 13:07:45cedsetmessages: + msg43838
2018-09-11 18:40:26risto3setmessages: + msg43817
2018-09-11 13:02:04reviewbotsetnosy: + reviewbot
messages: + msg43816
2018-09-11 12:30:35cedsetstatus: in-progress -> testing
reviews: 72311002
keyword: + review
2018-09-11 12:11:42cedsetstatus: unread -> in-progress
assignedto: ced
type: behavior
nosy: + ced

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