changeset 8b8feaf064af in modules/purchase:default
details: https://hg.tryton.org/modules/purchase?cmd=changeset;node=8b8feaf064af
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:

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

diffs (24 lines):

diff -r 98099dc73eb3 -r 8b8feaf064af purchase.py
--- a/purchase.py       Thu Sep 03 09:01:26 2020 +0200
+++ b/purchase.py       Sat Sep 05 23:37:58 2020 +0200
@@ -495,14 +495,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