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

        issue8927
        review325451002
diffstat:

 CHANGELOG     |   2 ++
 doc/index.rst |   2 +-
 production.py |  31 ++++++++++++++++++-------------
 3 files changed, 21 insertions(+), 14 deletions(-)

diffs (118 lines):

diff -r decd359569fc -r edfcb7216191 CHANGELOG
--- a/CHANGELOG Mon Jun 01 10:08:02 2020 +0100
+++ b/CHANGELOG Sat Jun 06 10:19:09 2020 +0100
@@ -1,3 +1,5 @@
+* Rename production state from cancel to cancelled
+
 Version 5.6.0 - 2020-05-04
 * Bug fixes (see mercurial logs for details)
 * Add origin to production
diff -r decd359569fc -r edfcb7216191 doc/index.rst
--- a/doc/index.rst     Mon Jun 01 10:08:02 2020 +0100
+++ b/doc/index.rst     Sat Jun 06 10:19:09 2020 +0100
@@ -53,7 +53,7 @@
 
   The output moves are in state done.
 
-* Cancel
+* Cancelled
 
   All moves are cancelled.
 
diff -r decd359569fc -r edfcb7216191 production.py
--- a/production.py     Mon Jun 01 10:08:02 2020 +0100
+++ b/production.py     Sat Jun 06 10:19:09 2020 +0100
@@ -35,7 +35,7 @@
         depends=['state'])
     effective_date = fields.Date('Effective Date',
         states={
-            'readonly': Eval('state').in_(['cancel', 'done']),
+            'readonly': Eval('state').in_(['cancelled', 'done']),
             },
         depends=['state'])
     planned_start_date = fields.Date('Planned Start Date',
@@ -46,7 +46,7 @@
         depends=['state', 'planned_date'])
     effective_start_date = fields.Date('Effective Start Date',
         states={
-            'readonly': Eval('state').in_(['cancel', 'running', 'done']),
+            'readonly': Eval('state').in_(['cancelled', 'running', 'done']),
             },
         depends=['state'])
     company = fields.Many2One('company.company', 'Company', required=True,
@@ -134,7 +134,7 @@
             ('company', '=', Eval('company', -1)),
             ],
         states={
-            'readonly': (Eval('state').in_(['done', 'cancel'])
+            'readonly': (Eval('state').in_(['done', 'cancelled'])
                 | ~Eval('warehouse') | ~Eval('location')),
             },
         depends=['warehouse', 'location', 'company'])
@@ -149,7 +149,7 @@
             ('assigned', 'Assigned'),
             ('running', 'Running'),
             ('done', 'Done'),
-            ('cancel', 'Canceled'),
+            ('cancelled', 'Cancelled'),
             ], 'State', readonly=True)
     origin = fields.Reference(
         "Origin", selection='get_origin', select=True,
@@ -171,11 +171,11 @@
                 ('assigned', 'waiting'),
                 ('waiting', 'waiting'),
                 ('waiting', 'draft'),
-                ('request', 'cancel'),
-                ('draft', 'cancel'),
-                ('waiting', 'cancel'),
-                ('assigned', 'cancel'),
-                ('cancel', 'draft'),
+                ('request', 'cancelled'),
+                ('draft', 'cancelled'),
+                ('waiting', 'cancelled'),
+                ('assigned', 'cancelled'),
+                ('cancelled', 'draft'),
                 ))
         cls._buttons.update({
                 'cancel': {
@@ -185,8 +185,8 @@
                     },
                 'draft': {
                     'invisible': ~Eval('state').in_(['request', 'waiting',
-                            'cancel']),
-                    'icon': If(Eval('state') == 'cancel',
+                            'cancelled']),
+                    'icon': If(Eval('state') == 'cancelled',
                         'tryton-clear',
                         If(Eval('state') == 'request',
                             'tryton-forward',
@@ -264,6 +264,11 @@
                 where=(table.planned_start_date == Null)
                 & (table.planned_date != Null)))
 
+        # Migration from 5.6: rename state cancel to cancelled
+        cursor.execute(*table.update(
+                [table.state], ['cancelled'],
+                where=table.state == 'cancel'))
+
     @staticmethod
     def default_state():
         return 'draft'
@@ -560,7 +565,7 @@
     @classmethod
     def view_attributes(cls):
         return [
-            ('/tree', 'visual', If(Eval('state') == 'cancel', 'muted', '')),
+            ('/tree', 'visual', If(Eval('state') == 'cancelled', 'muted', '')),
             ]
 
     @classmethod
@@ -626,7 +631,7 @@
 
     @classmethod
     @ModelView.button
-    @Workflow.transition('cancel')
+    @Workflow.transition('cancelled')
     def cancel(cls, productions):
         pool = Pool()
         Move = pool.get('stock.move')

Reply via email to