changeset 062abe7fd21b in modules/stock_forecast:default
details:
https://hg.tryton.org/modules/stock_forecast?cmd=changeset;node=062abe7fd21b
description:
Rename forecast state from cancel to cancelled
issue8927
review323371002
diffstat:
CHANGELOG | 2 ++
doc/index.rst | 2 +-
forecast.py | 18 +++++++++++++-----
3 files changed, 16 insertions(+), 6 deletions(-)
diffs (85 lines):
diff -r 462e2d72e9e6 -r 062abe7fd21b CHANGELOG
--- a/CHANGELOG Mon May 04 12:30:54 2020 +0200
+++ b/CHANGELOG Thu Jun 04 11:01:07 2020 +0100
@@ -1,3 +1,5 @@
+* Rename forecast state from cancel to cancelled
+
Version 5.6.0 - 2020-05-04
* Bug fixes (see mercurial logs for details)
diff -r 462e2d72e9e6 -r 062abe7fd21b doc/index.rst
--- a/doc/index.rst Mon May 04 12:30:54 2020 +0200
+++ b/doc/index.rst Thu Jun 04 11:01:07 2020 +0100
@@ -46,7 +46,7 @@
- Move quantities are bigger or equal to the minimal quantity set
on the forecast line.
-Cancel
+Cancelled
On a cancelled forecast all existing moves are cancelled and the form
is readonly.
diff -r 462e2d72e9e6 -r 062abe7fd21b forecast.py
--- a/forecast.py Mon May 04 12:30:54 2020 +0200
+++ b/forecast.py Thu Jun 04 11:01:07 2020 +0100
@@ -61,7 +61,7 @@
state = fields.Selection([
('draft', "Draft"),
('done', "Done"),
- ('cancel', "Cancel"),
+ ('cancelled', "Cancelled"),
], "State", readonly=True, select=True)
active = fields.Function(fields.Boolean('Active'),
'get_active', searcher='search_active')
@@ -75,9 +75,9 @@
cls._order.insert(1, ('warehouse', 'ASC'))
cls._transitions |= set((
('draft', 'done'),
- ('draft', 'cancel'),
+ ('draft', 'cancelled'),
('done', 'draft'),
- ('cancel', 'draft'),
+ ('cancelled', 'draft'),
))
cls._buttons.update({
'cancel': {
@@ -101,6 +101,9 @@
@classmethod
def __register__(cls, module_name):
+ cursor = Transaction().connection.cursor()
+ sql_table = cls.__table__()
+
super(Forecast, cls).__register__(module_name)
# Add index on create_date
@@ -110,6 +113,11 @@
# Migration from 5.0: remove check_from_to_date
table.drop_constraint('check_from_to_date')
+ # 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_state():
return 'draft'
@@ -197,7 +205,7 @@
# Cancel before delete
cls.cancel(forecasts)
for forecast in forecasts:
- if forecast.state != 'cancel':
+ if forecast.state != 'cancelled':
raise AccessError(
gettext('stock_forecast.msg_forecast_delete_cancel',
forecast=forecast.rec_name))
@@ -217,7 +225,7 @@
@classmethod
@ModelView.button
- @Workflow.transition('cancel')
+ @Workflow.transition('cancelled')
def cancel(cls, forecasts):
pass