changeset c5c142249cc0 in modules/sale_supply_drop_shipment:default
details:
https://hg.tryton.org/modules/sale_supply_drop_shipment?cmd=changeset;node=c5c142249cc0
description:
Rename code into number
issue9984
review339591002
diffstat:
stock.py | 14 +++++++++++---
view/shipment_drop_form.xml | 4 ++--
view/shipment_drop_tree.xml | 2 +-
3 files changed, 14 insertions(+), 6 deletions(-)
diffs (78 lines):
diff -r 2954d734c98d -r c5c142249cc0 stock.py
--- a/stock.py Wed Jan 13 00:28:29 2021 +0100
+++ b/stock.py Wed Feb 03 19:38:18 2021 +0100
@@ -88,7 +88,7 @@
class ShipmentDrop(Workflow, ModelSQL, ModelView):
"Drop Shipment"
__name__ = 'stock.shipment.drop'
-
+ _rec_name = 'number'
effective_date = fields.Date(
"Effective Date",
states={
@@ -168,7 +168,9 @@
'readonly': Eval('state') != 'shipped',
},
depends=['state', 'customer'])
- code = fields.Char('Code', select=1, readonly=True)
+ number = fields.Char(
+ "Number", select=True, readonly=True,
+ help="The main identifier for the shipment.")
state = fields.Selection([
('draft', 'Draft'),
('waiting', 'Waiting'),
@@ -193,6 +195,11 @@
location = Location.__table__()
cursor = Transaction().connection.cursor()
+ table_h = cls.__table_handler__(module_name)
+ # Migration from 5.8: rename code into number
+ if table_h.column_exist('code'):
+ table_h.column_rename('code', 'number')
+
super(ShipmentDrop, cls).__register__(module_name)
# Migration from 3.6
@@ -253,6 +260,7 @@
@classmethod
def __setup__(cls):
super(ShipmentDrop, cls).__setup__()
+ cls._order[0] = ('id', 'DESC')
cls._transitions |= set((
('draft', 'waiting'),
('waiting', 'shipped'),
@@ -343,7 +351,7 @@
vlist = [x.copy() for x in vlist]
config = Config(1)
for values in vlist:
- values['code'] = Sequence.get_id(config.shipment_drop_sequence)
+ values['number'] = Sequence.get_id(config.shipment_drop_sequence)
shipments = super(ShipmentDrop, cls).create(vlist)
cls._set_move_planned_date(shipments)
return shipments
diff -r 2954d734c98d -r c5c142249cc0 view/shipment_drop_form.xml
--- a/view/shipment_drop_form.xml Wed Jan 13 00:28:29 2021 +0100
+++ b/view/shipment_drop_form.xml Wed Feb 03 19:38:18 2021 +0100
@@ -4,8 +4,8 @@
<form cursor="supplier">
<label name="reference"/>
<field name="reference"/>
- <label name="code"/>
- <field name="code"/>
+ <label name="number"/>
+ <field name="number"/>
<label name="supplier"/>
<field name="supplier"/>
<label name="contact_address"/>
diff -r 2954d734c98d -r c5c142249cc0 view/shipment_drop_tree.xml
--- a/view/shipment_drop_tree.xml Wed Jan 13 00:28:29 2021 +0100
+++ b/view/shipment_drop_tree.xml Wed Feb 03 19:38:18 2021 +0100
@@ -2,7 +2,7 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
- <field name="code" expand="1"/>
+ <field name="number" expand="1"/>
<field name="reference" expand="1"/>
<field name="planned_date"/>
<field name="effective_date"/>