Rename cancel state to cancelled
issue8927 review291801003
This commit is contained in:
1 parent
2c29e15ccc
commit
09f2e7a3a1
2 files changed
+14
-5
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Rename landed cost state from cancel to cancelled
|
||||
|
||||
Version 5.6.0 - 2020-05-04
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
|
||||
|
||||
+12
-5
@@ -115,7 +115,7 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
('posted', 'Posted'),
|
||||
('cancel', 'Canceled'),
|
||||
('cancelled', 'Cancelled'),
|
||||
], 'State', readonly=True)
|
||||
|
||||
@classmethod
|
||||
@@ -128,8 +128,8 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('draft', 'posted'),
|
||||
('draft', 'cancel'),
|
||||
('cancel', 'draft'),
|
||||
('draft', 'cancelled'),
|
||||
('cancelled', 'draft'),
|
||||
))
|
||||
cls._buttons.update({
|
||||
'cancel': {
|
||||
@@ -137,7 +137,7 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||
'depends': ['state'],
|
||||
},
|
||||
'draft': {
|
||||
'invisible': Eval('state') != 'cancel',
|
||||
'invisible': Eval('state') != 'cancelled',
|
||||
'depends': ['state'],
|
||||
},
|
||||
'post': {
|
||||
@@ -148,7 +148,9 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
cursor = Transaction().connection.cursor()
|
||||
table_h = cls.__table_handler__(module_name)
|
||||
sql_table = cls.__table__()
|
||||
|
||||
# Migration from 3.8: rename code into number
|
||||
if table_h.column_exist('code'):
|
||||
@@ -156,6 +158,11 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||
|
||||
super(LandedCost, cls).__register__(module_name)
|
||||
|
||||
# Migration from 5.6: rename state cancel to cancelled
|
||||
cursor.execute(*sql_table.update(
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
@@ -170,7 +177,7 @@ class LandedCost(Workflow, ModelSQL, ModelView):
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('cancel')
|
||||
@Workflow.transition('cancelled')
|
||||
def cancel(cls, landed_costs):
|
||||
pass
|
||||
|
||||
|
||||
Reference in new issue
Block a user