changeset 25fb3e3dee84 in modules/account_statement:default
details:
https://hg.tryton.org/modules/account_statement?cmd=changeset;node=25fb3e3dee84
description:
Rename statement state from cancel to cancelled
issue8927
review309681006
diffstat:
CHANGELOG | 2 ++
doc/index.rst | 4 ++--
statement.fodt | 4 ++--
statement.py | 23 ++++++++++++++---------
tests/scenario_account_statement.rst | 2 +-
5 files changed, 21 insertions(+), 14 deletions(-)
diffs (129 lines):
diff -r c01a24c5b93e -r 25fb3e3dee84 CHANGELOG
--- a/CHANGELOG Mon May 04 12:11:36 2020 +0200
+++ b/CHANGELOG Thu Jun 04 11:11:01 2020 +0100
@@ -1,3 +1,5 @@
+* Rename statement state from cancel to cancelled
+
Version 5.6.0 - 2020-05-04
* Bug fixes (see mercurial logs for details)
* Prevent posting move from statement that is not posted
diff -r c01a24c5b93e -r 25fb3e3dee84 doc/index.rst
--- a/doc/index.rst Mon May 04 12:11:36 2020 +0200
+++ b/doc/index.rst Thu Jun 04 11:11:01 2020 +0100
@@ -29,9 +29,9 @@
The statement is posted which means all the moves have been posted.
-* Canceled
+* Cancelled
- The statement is canceled which means all the moves previously created have
+ The statement is cancelled which means all the moves previously created have
been deleted.
Line
diff -r c01a24c5b93e -r 25fb3e3dee84 statement.fodt
--- a/statement.fodt Mon May 04 12:11:36 2020 +0200
+++ b/statement.fodt Thu Jun 04 11:11:01 2020 +0100
@@ -474,8 +474,8 @@
<text:p text:style-name="Standard"><text:placeholder
text:placeholder-type="text"><when test="statement.state ==
'draft'"></text:placeholder></text:p>
<text:p text:style-name="P13"><text:span text:style-name="T1">Draft
</text:span>Statement</text:p>
<text:p text:style-name="Standard"><text:placeholder
text:placeholder-type="text"></when></text:placeholder></text:p>
- <text:p text:style-name="P8"><text:placeholder
text:placeholder-type="text"><when test="statement.state ==
'canceled'"></text:placeholder></text:p>
- <text:p text:style-name="P13"><text:span text:style-name="T1">Canceled
</text:span>Statement</text:p>
+ <text:p text:style-name="P8"><text:placeholder
text:placeholder-type="text"><when test="statement.state ==
'cancelled'"></text:placeholder></text:p>
+ <text:p text:style-name="P13"><text:span text:style-name="T1">Cancelled
</text:span>Statement</text:p>
<text:p text:style-name="P8"><text:placeholder
text:placeholder-type="text"></when></text:placeholder></text:p>
<text:p text:style-name="P8"><text:placeholder
text:placeholder-type="text"><otherwise></text:placeholder></text:p>
<text:p text:style-name="P12">Statement</text:p>
diff -r c01a24c5b93e -r 25fb3e3dee84 statement.py
--- a/statement.py Mon May 04 12:11:36 2020 +0200
+++ b/statement.py Thu Jun 04 11:11:01 2020 +0100
@@ -123,7 +123,7 @@
state = fields.Selection([
('draft', "Draft"),
('validated', "Validated"),
- ('cancel', "Canceled"),
+ ('cancelled', "Cancelled"),
('posted', "Posted"),
], "State", readonly=True, select=True)
validation = fields.Function(fields.Char('Validation'),
@@ -142,14 +142,14 @@
cls._order[0] = ('id', 'DESC')
cls._transitions |= set((
('draft', 'validated'),
- ('draft', 'cancel'),
+ ('draft', 'cancelled'),
('validated', 'posted'),
- ('validated', 'cancel'),
- ('cancel', 'draft'),
+ ('validated', 'cancelled'),
+ ('cancelled', 'draft'),
))
cls._buttons.update({
'draft': {
- 'invisible': Eval('state') != 'cancel',
+ 'invisible': Eval('state') != 'cancelled',
'depends': ['state'],
},
'validate_statement': {
@@ -165,7 +165,7 @@
'depends': ['state'],
},
'reconcile': {
- 'invisible': Eval('state').in_(['draft', 'cancel']),
+ 'invisible': Eval('state').in_(['draft', 'cancelled']),
'readonly': ~Eval('to_reconcile'),
'depends': ['state', 'to_reconcile'],
},
@@ -193,6 +193,11 @@
[sql_table.id.cast(cls.name.sql_type().base)],
where=sql_table.name == Null))
+ # 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')
@@ -412,7 +417,7 @@
@classmethod
def view_attributes(cls):
return [
- ('/tree', 'visual', If(Eval('state') == 'cancel', 'muted', '')),
+ ('/tree', 'visual', If(Eval('state') == 'cancelled', 'muted', '')),
]
@classmethod
@@ -420,7 +425,7 @@
# Cancel before delete
cls.cancel(statements)
for statement in statements:
- if statement.state != 'cancel':
+ if statement.state != 'cancelled':
raise AccessError(
gettext('account_statement.msg_statement_delete_cancel',
statement=statement.rec_name))
@@ -631,7 +636,7 @@
@classmethod
@ModelView.button
- @Workflow.transition('cancel')
+ @Workflow.transition('cancelled')
def cancel(cls, statements):
StatementLine = Pool().get('account.statement.line')
diff -r c01a24c5b93e -r 25fb3e3dee84 tests/scenario_account_statement.rst
--- a/tests/scenario_account_statement.rst Mon May 04 12:11:36 2020 +0200
+++ b/tests/scenario_account_statement.rst Thu Jun 04 11:11:01 2020 +0100
@@ -221,7 +221,7 @@
>>> statement.click('cancel')
>>> statement.state
- 'cancel'
+ 'cancelled'
>>> [l.move for l in statement.lines if l.move]
[]