Rename production state from cancel to cancelled

issue8927
review325451002
This commit is contained in:
David Harper
2020-06-06 10:19:09 +01:00
parent fa563408ef
commit 3f9bdc205d
3 changed files with 21 additions and 14 deletions
+2
View File
@@ -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
+1 -1
View File
@@ -53,7 +53,7 @@ The production can be in one of this states:
The output moves are in state done.
* Cancel
* Cancelled
All moves are cancelled.
+18 -13
View File
@@ -35,7 +35,7 @@ class Production(Workflow, ModelSQL, ModelView):
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 @@ class Production(Workflow, ModelSQL, ModelView):
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 @@ class Production(Workflow, ModelSQL, ModelView):
('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 @@ class Production(Workflow, ModelSQL, ModelView):
('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 @@ class Production(Workflow, ModelSQL, ModelView):
('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 @@ class Production(Workflow, ModelSQL, ModelView):
},
'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 @@ class Production(Workflow, ModelSQL, ModelView):
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 @@ class Production(Workflow, ModelSQL, ModelView):
@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 @@ class Production(Workflow, ModelSQL, ModelView):
@classmethod
@ModelView.button
@Workflow.transition('cancel')
@Workflow.transition('cancelled')
def cancel(cls, productions):
pool = Pool()
Move = pool.get('stock.move')