Rename subscription state from canceled to cancelled
issue8927 review301701002
This commit is contained in:
1 parent
78b0ef0e94
commit
edcc7cd14a
4 files changed
+26
-11
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Rename subscription state from canceled to cancelled
|
||||
|
||||
Version 5.6.0 - 2020-05-04
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Add employee on subscriptions for some states
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ extensive list of the fields:
|
||||
- End Date: An optional earlier end date than the subscription.
|
||||
|
||||
- States: The state of the subscription. May take one of the following values:
|
||||
Draft, Quotation, Running, Closed, Canceled.
|
||||
Draft, Quotation, Running, Closed, Cancelled.
|
||||
- Company: The company which issue the sale order.
|
||||
|
||||
A running subscription can be modified by going back to draft and edit. Some
|
||||
|
||||
@@ -27,7 +27,7 @@ class Erase(metaclass=PoolMeta):
|
||||
subscriptions = Subscription.search([
|
||||
('party', '=', party.id),
|
||||
('company', '=', company.id),
|
||||
('state', 'not in', ['closed', 'canceled']),
|
||||
('state', 'not in', ['closed', 'cancelled']),
|
||||
])
|
||||
if subscriptions:
|
||||
raise EraseError(
|
||||
|
||||
+22
-9
@@ -146,15 +146,15 @@ class Subscription(Workflow, ModelSQL, ModelView):
|
||||
depends=['state'])
|
||||
|
||||
quoted_by = employee_field(
|
||||
"Quoted By", states=['quotation', 'running', 'closed', 'canceled'])
|
||||
"Quoted By", states=['quotation', 'running', 'closed', 'cancelled'])
|
||||
run_by = employee_field(
|
||||
"Run By", states=['running', 'closed', 'canceled'])
|
||||
"Run By", states=['running', 'closed', 'cancelled'])
|
||||
state = fields.Selection([
|
||||
('draft', "Draft"),
|
||||
('quotation', "Quotation"),
|
||||
('running', "Running"),
|
||||
('closed', "Closed"),
|
||||
('canceled', "Canceled"),
|
||||
('cancelled', "Cancelled"),
|
||||
], "State", readonly=True, required=True,
|
||||
help="The current state of the subscription.")
|
||||
|
||||
@@ -166,14 +166,14 @@ class Subscription(Workflow, ModelSQL, ModelView):
|
||||
('id', 'DESC'),
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('draft', 'canceled'),
|
||||
('draft', 'cancelled'),
|
||||
('draft', 'quotation'),
|
||||
('quotation', 'canceled'),
|
||||
('quotation', 'cancelled'),
|
||||
('quotation', 'draft'),
|
||||
('quotation', 'running'),
|
||||
('running', 'draft'),
|
||||
('running', 'closed'),
|
||||
('canceled', 'draft'),
|
||||
('cancelled', 'draft'),
|
||||
))
|
||||
cls._buttons.update({
|
||||
'cancel': {
|
||||
@@ -183,7 +183,7 @@ class Subscription(Workflow, ModelSQL, ModelView):
|
||||
},
|
||||
'draft': {
|
||||
'invisible': Eval('state').in_(['draft', 'closed']),
|
||||
'icon': If(Eval('state') == 'canceled',
|
||||
'icon': If(Eval('state') == 'cancelled',
|
||||
'tryton-undo', 'tryton-back'),
|
||||
'depends': ['state'],
|
||||
},
|
||||
@@ -200,6 +200,18 @@ class Subscription(Workflow, ModelSQL, ModelView):
|
||||
},
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
cursor = Transaction().connection.cursor()
|
||||
table = cls.__table__()
|
||||
|
||||
super().__register__(module_name)
|
||||
|
||||
# Migration from 5.6: rename state canceled to cancelled
|
||||
cursor.execute(*table.update(
|
||||
[table.state], ['cancelled'],
|
||||
where=table.state == 'canceled'))
|
||||
|
||||
@classmethod
|
||||
def default_company(cls):
|
||||
return Transaction().context.get('company')
|
||||
@@ -269,12 +281,13 @@ class Subscription(Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return [
|
||||
('/tree', 'visual', If(Eval('state') == 'canceled', 'muted', '')),
|
||||
('/tree', 'visual',
|
||||
If(Eval('state') == 'cancelled', 'muted', '')),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('canceled')
|
||||
@Workflow.transition('cancelled')
|
||||
def cancel(cls, subscriptions):
|
||||
pass
|
||||
|
||||
|
||||
Reference in new issue
Block a user