changeset 708202af1348 in modules/commission:default
details: 
https://hg.tryton.org/modules/commission?cmd=changeset;node=708202af1348
description:
        Rename invoice state from cancel to cancelled

        issue8927
        review303661003
diffstat:

 commission.py |  9 +++------
 invoice.py    |  2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diffs (38 lines):

diff -r f8407e3160c4 -r 708202af1348 commission.py
--- a/commission.py     Mon Jun 01 10:08:02 2020 +0100
+++ b/commission.py     Sat Jun 06 10:23:14 2020 +0100
@@ -327,7 +327,7 @@
                 ('', ''),
                 ('invoiced', 'Invoiced'),
                 ('paid', 'Paid'),
-                ('cancel', 'Canceled'),
+                ('cancelled', 'Cancelled'),
                 ], "Invoice State",
             help="The current state of the invoice "
             "that the commission appears on."),
@@ -381,11 +381,8 @@
         if self.invoice_line:
             state = 'invoiced'
             invoice = self.invoice_line.invoice
-            if invoice:
-                if invoice.state == 'paid':
-                    state = 'paid'
-                elif invoice.state == 'cancel':
-                    state = 'cancel'
+            if invoice and invoice.state in {'paid', 'cancelled'}:
+                state = invoice.state
         return state
 
     @classmethod
diff -r f8407e3160c4 -r 708202af1348 invoice.py
--- a/invoice.py        Mon Jun 01 10:08:02 2020 +0100
+++ b/invoice.py        Sat Jun 06 10:23:14 2020 +0100
@@ -70,7 +70,7 @@
 
     @classmethod
     @ModelView.button
-    @Workflow.transition('cancel')
+    @Workflow.transition('cancelled')
     def cancel(cls, invoices):
         pool = Pool()
         Commission = pool.get('commission')

Reply via email to