changeset 857ff37a0a2c in modules/sale_supply_drop_shipment:default
details:
https://hg.tryton.org/modules/sale_supply_drop_shipment?cmd=changeset;node=857ff37a0a2c
description:
Rename drop shipment state from cancel to cancelled
issue8927
review321401002
diffstat:
CHANGELOG | 2 ++
doc/index.rst | 2 +-
party.py | 2 +-
stock.py | 28 +++++++++++++++++-----------
4 files changed, 21 insertions(+), 13 deletions(-)
diffs (120 lines):
diff -r e6bb918f7d08 -r 857ff37a0a2c CHANGELOG
--- a/CHANGELOG Fri May 22 11:49:35 2020 +0200
+++ b/CHANGELOG Thu Jun 04 11:05:27 2020 +0100
@@ -1,3 +1,5 @@
+* Rename drop shipment state from cancel to cancelled
+
Version 5.6.0 - 2020-05-04
* Bug fixes (see mercurial logs for details)
diff -r e6bb918f7d08 -r 857ff37a0a2c doc/index.rst
--- a/doc/index.rst Fri May 22 11:49:35 2020 +0200
+++ b/doc/index.rst Thu Jun 04 11:05:27 2020 +0100
@@ -33,6 +33,6 @@
All moves are in state Done.
-* Cancel
+* Cancelled
All moves are cancelled.
diff -r e6bb918f7d08 -r 857ff37a0a2c party.py
--- a/party.py Fri May 22 11:49:35 2020 +0200
+++ b/party.py Thu Jun 04 11:05:27 2020 +0100
@@ -33,7 +33,7 @@
('customer', '=', party.id),
],
('company', '=', company.id),
- ('state', 'not in', ['done', 'cancel']),
+ ('state', 'not in', ['done', 'cancelled']),
])
if shipments:
raise EraseError(
diff -r e6bb918f7d08 -r 857ff37a0a2c stock.py
--- a/stock.py Fri May 22 11:49:35 2020 +0200
+++ b/stock.py Thu Jun 04 11:05:27 2020 +0100
@@ -152,7 +152,7 @@
'Supplier Moves',
filter=[('to_location.type', '=', 'drop')],
states={
- 'readonly': Eval('state').in_(['shipped', 'done', 'cancel']),
+ 'readonly': Eval('state').in_(['shipped', 'done', 'cancelled']),
},
depends=['state', 'supplier'])
customer_moves = fields.One2Many('stock.move', 'shipment',
@@ -168,7 +168,7 @@
('waiting', 'Waiting'),
('shipped', 'Shipped'),
('done', 'Done'),
- ('cancel', 'Canceled'),
+ ('cancelled', 'Cancelled'),
], 'State', readonly=True)
@classmethod
@@ -179,6 +179,7 @@
PurchaseRequest = pool.get('purchase.request')
SaleLine = pool.get('sale.line')
Location = pool.get('stock.location')
+ table = cls.__table__()
move = Move.__table__()
purchase_line = PurchaseLine.__table__()
purchase_request = PurchaseRequest.__table__()
@@ -238,28 +239,33 @@
drop_shipment_location, customer_location],
where=(move.id == move_id)))
+ # Migration from 5.6: rename state cancel to cancelled
+ cursor.execute(*table.update(
+ [table.state], ['cancelled'],
+ where=table.state == 'cancel'))
+
@classmethod
def __setup__(cls):
super(ShipmentDrop, cls).__setup__()
cls._transitions |= set((
('draft', 'waiting'),
('waiting', 'shipped'),
- ('draft', 'cancel'),
- ('waiting', 'cancel'),
+ ('draft', 'cancelled'),
+ ('waiting', 'cancelled'),
('waiting', 'draft'),
- ('cancel', 'draft'),
+ ('cancelled', 'draft'),
('shipped', 'done'),
- ('shipped', 'cancel'),
+ ('shipped', 'cancelled'),
))
cls._buttons.update({
'cancel': {
- 'invisible': Eval('state').in_(['cancel', 'done']),
+ 'invisible': Eval('state').in_(['cancelled', 'done']),
'depends': ['state'],
},
'draft': {
- 'invisible': ~Eval('state').in_(['cancel', 'draft',
+ 'invisible': ~Eval('state').in_(['cancelled', 'draft',
'waiting']),
- 'icon': If(Eval('state') == 'cancel',
+ 'icon': If(Eval('state') == 'cancelled',
'tryton-undo', 'tryton-back'),
'depends': ['state'],
},
@@ -356,7 +362,7 @@
cls.cancel(shipments)
for shipment in shipments:
- if shipment.state != 'cancel':
+ if shipment.state != 'cancelled':
raise AccessError(
gettext('sale_supply_drop_shipment'
'.msg_drop_shipment_delete_cancel') % {
@@ -367,7 +373,7 @@
@classmethod
@ModelView.button
- @Workflow.transition('cancel')
+ @Workflow.transition('cancelled')
@process_sale('customer_moves')
@process_purchase('supplier_moves')
def cancel(cls, shipments):