changeset 68946c509368 in modules/account_stock_landed_cost:default
details:
https://hg.tryton.org/modules/account_stock_landed_cost?cmd=changeset;node=68946c509368
description:
Rename cancel state to cancelled
issue8927
review291801003
diffstat:
CHANGELOG | 2 ++
account.py | 17 ++++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diffs (72 lines):
diff -r 0b9bfec73fca -r 68946c509368 CHANGELOG
--- a/CHANGELOG Mon May 04 12:13:03 2020 +0200
+++ b/CHANGELOG Thu Jun 04 10:56:46 2020 +0100
@@ -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)
diff -r 0b9bfec73fca -r 68946c509368 account.py
--- a/account.py Mon May 04 12:13:03 2020 +0200
+++ b/account.py Thu Jun 04 10:56:46 2020 +0100
@@ -115,7 +115,7 @@
state = fields.Selection([
('draft', 'Draft'),
('posted', 'Posted'),
- ('cancel', 'Canceled'),
+ ('cancelled', 'Cancelled'),
], 'State', readonly=True)
@classmethod
@@ -128,8 +128,8 @@
]
cls._transitions |= set((
('draft', 'posted'),
- ('draft', 'cancel'),
- ('cancel', 'draft'),
+ ('draft', 'cancelled'),
+ ('cancelled', 'draft'),
))
cls._buttons.update({
'cancel': {
@@ -137,7 +137,7 @@
'depends': ['state'],
},
'draft': {
- 'invisible': Eval('state') != 'cancel',
+ 'invisible': Eval('state') != 'cancelled',
'depends': ['state'],
},
'post': {
@@ -148,7 +148,9 @@
@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 @@
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 @@
@classmethod
@ModelView.button
- @Workflow.transition('cancel')
+ @Workflow.transition('cancelled')
def cancel(cls, landed_costs):
pass