changeset 5c3a4ead529c in modules/account_invoice_history:default
details:
https://hg.tryton.org/modules/account_invoice_history?cmd=changeset&node=5c3a4ead529c
description:
Fill history_datetime only if numbered
Otherwise it is the creation date of party or address or payment term
that is
used anyway.
issue10523
review336491009
diffstat:
account.py | 9 ++++++---
setup.py | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diffs (44 lines):
diff -r febd8b65123b -r 5c3a4ead529c account.py
--- a/account.py Mon May 03 15:50:42 2021 +0200
+++ b/account.py Thu Jun 24 09:21:14 2021 +0200
@@ -1,5 +1,6 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+from sql import Null
from sql.conditionals import Greatest
from sql.functions import CurrentTimestamp
@@ -57,8 +58,9 @@
payment_term = PaymentTerm.__table__()
cursor = Transaction().connection.cursor()
- datetimes = {}
- for ids in grouped_slice([i.id for i in invoices]):
+ invoice_ids = [i.id for i in invoices]
+ datetimes = dict.fromkeys(invoice_ids)
+ for ids in grouped_slice(invoice_ids):
cursor.execute(*table
.join(party, condition=table.party == party.id)
.join(address, condition=table.invoice_address == address.id)
@@ -67,7 +69,8 @@
.select(table.id,
Greatest(table.numbered_at, party.create_date,
address.create_date, payment_term.create_date),
- where=reduce_ids(table.id, ids)))
+ where=reduce_ids(table.id, ids)
+ & (table.numbered_at != Null)))
datetimes.update(cursor)
return datetimes
diff -r febd8b65123b -r 5c3a4ead529c setup.py
--- a/setup.py Mon May 03 15:50:42 2021 +0200
+++ b/setup.py Thu Jun 24 09:21:14 2021 +0200
@@ -57,7 +57,7 @@
if local_version:
version += '+' + '.'.join(local_version)
-requires = []
+requires = ['python-sql >= 0.4']
for dep in info.get('depends', []):
if not re.match(r'(ir|res)(\W|$)', dep):
requires.append(get_require_version('trytond_%s' % dep))