changeset 623395f86849 in modules/sale:default
details: https://hg.tryton.org/modules/sale?cmd=changeset;node=623395f86849
description:
        Allow setting the tax date on taxable lines

        We add a taxing date to the invoice line which allow overriding the 
value of
        the invoice.
        When crediting an invoice, the original tax date of each line is stored 
on the
        credit line so the tax are computed the same way.

        issue9520
        review323791002
diffstat:

 sale.py |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (24 lines):

diff -r 2a30c2fae7ac -r 623395f86849 sale.py
--- a/sale.py   Thu Sep 03 09:01:14 2020 +0200
+++ b/sale.py   Sat Sep 05 23:37:58 2020 +0200
@@ -489,14 +489,12 @@
         for line in self.lines:
             if getattr(line, 'type', None) != 'line':
                 continue
-            taxable_lines.append(tuple())
-            for attribute, default_value in (
-                    ('taxes', []),
-                    ('unit_price', Decimal(0)),
-                    ('quantity', 0.0)):
-                value = getattr(line, attribute, None)
-                taxable_lines[-1] += (value
-                    if value is not None else default_value,)
+            taxable_lines.append((
+                    getattr(line, 'taxes', None) or [],
+                    getattr(line, 'unit_price', None) or Decimal(0),
+                    getattr(line, 'quantity', None) or 0,
+                    None,
+                    ))
         return taxable_lines
 
     @fields.depends(methods=['_get_taxes'])

Reply via email to