Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
bfe756dd by Cédric Krier at 2023-03-15T23:24:27+01:00
Update invoice state for purchase standalone invoice line

Changeset 5cc007f4b86ac introduced new state and renamed waiting to pending.
- - - - -


1 changed file:

- modules/purchase_invoice_line_standalone/purchase.py


Changes:

=====================================
modules/purchase_invoice_line_standalone/purchase.py
=====================================
@@ -38,18 +38,14 @@
 
     def get_invoice_state(self):
         state = super(Purchase, self).get_invoice_state()
-        skips = set(x.id for x in self.invoice_lines_ignored)
-        invoice_lines = [l for l in self.invoice_lines if l.id not in skips]
-        if invoice_lines:
-            if any(l.invoice and l.invoice.state == 'cancelled'
-                    for l in invoice_lines):
-                return 'exception'
-            elif (state == 'paid'
-                    and all(l.invoice for l in invoice_lines)
-                    and all(l.invoice.state == 'paid' for l in invoice_lines)):
-                return 'paid'
-            else:
-                return 'waiting'
+        skips = set(self.invoice_lines_ignored)
+        standalone_lines = [
+            l for l in self.invoice_lines if l not in skips and not l.invoice]
+        if standalone_lines:
+            state = {
+                'paid': 'partially paid',
+                'none': 'pending',
+                }.get(state, state)
         return state
 
     @classmethod



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/bfe756dd60e6befc2b996f33b53df96b7d30458f

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/bfe756dd60e6befc2b996f33b53df96b7d30458f
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to