Tryton - Issues

 

Issue8788

Title Take lines without maturity date as line to pay
Priority bug Status chatting
Superseder Nosy List ced, risto3
Type behavior Components account_invoice
Assigned To Keywords easy
Reviews

Created on 2019-11-03.16:53:27 by ced, last changed by ced.

Messages
msg53130 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-11.01:59:01
Then please do not submit patch.
msg53129 (view) Author: [hidden] (risto3) Date: 2019-11-10.22:56:27
no way, still requires g$$gle
msg53127 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-10.21:39:25
Please follow: https://www.tryton.org/develop
msg53125 (view) Author: [hidden] (risto3) Date: 2019-11-10.18:41:19
This seems okay too:

diff -r dce2c10d0a43 invoice.py
--- a/invoice.py        Sun Nov 10 17:55:10 2019 +0100
+++ b/invoice.py        Sun Nov 10 18:35:47 2019 +0100
@@ -4,7 +4,7 @@
 from collections import defaultdict, namedtuple
 from itertools import combinations
 
-from sql import Null
+from sql import Null, NullsLast
 from sql.aggregate import Sum
 from sql.conditionals import Coalesce, Case
 from sql.functions import Round
@@ -659,8 +659,8 @@
                 condition=((invoice.move == line.move)
                     & (invoice.account == line.account))).select(
                         invoice.id, line.id,
-                        where=(line.maturity_date != Null) & red_sql,
-                        order_by=(invoice.id, line.maturity_date)))
+                        where=red_sql,
+                        order_by=(invoice.id, NullsLast(line.maturity_date))))
             for invoice_id, line_id in cursor.fetchall():
                 lines[invoice_id].append(line_id)
         return lines
msg53017 (view) Author: [hidden] (risto3) Date: 2019-11-03.18:42:54
indeed, I quickly tried removing '(line.maturity_date != Null)' 
from https://hg.tryton.org/modules/account_invoice/file/tip/invoice.py#l662

that allows process() to work correctly with pertinent lines having null maturity_date, but I ignore if anything else needs checking.
msg53013 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-03.16:53:26
In rev 4a726694e1db, I added such constraint. The commit message is not clear but I think it was to prevent comparison in Python between date instance and None.
Now we use SQL for that so such constraint is useless (but we should order null last).
History
Date User Action Args
2019-11-11 01:59:01cedsetmessages: + msg53130
2019-11-10 22:56:27risto3setmessages: + msg53129
2019-11-10 21:39:25cedsetmessages: + msg53127
2019-11-10 18:41:20risto3setmessages: + msg53125
2019-11-03 18:42:55risto3setstatus: unread -> chatting
nosy: + risto3
messages: + msg53017
2019-11-03 16:53:27cedcreate

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