changeset 11631a8664bf in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=11631a8664bf
description:
        Allow resetting packed customer shipments

        issue11661
        review431471003
diffstat:

 CHANGELOG                  |   1 +
 shipment.py                |  21 ++++++++++++++++-----
 view/shipment_out_form.xml |   2 +-
 3 files changed, 18 insertions(+), 6 deletions(-)

diffs (81 lines):

diff -r 9dfa56e85ce4 -r 11631a8664bf CHANGELOG
--- a/CHANGELOG Thu Sep 08 13:12:48 2022 +0200
+++ b/CHANGELOG Thu Sep 08 13:19:52 2022 +0200
@@ -1,3 +1,4 @@
+* Allow resetting packed customer shipments
 * Allow grouping by date products by location
 * Ignore consumable products when inactivating locations
 
diff -r 9dfa56e85ce4 -r 11631a8664bf shipment.py
--- a/shipment.py       Thu Sep 08 13:12:48 2022 +0200
+++ b/shipment.py       Thu Sep 08 13:19:52 2022 +0200
@@ -1043,6 +1043,8 @@
                 ('waiting', 'packed'),
                 ('picked', 'packed'),
                 ('packed', 'done'),
+                ('packed', 'waiting'),
+                ('packed', 'picked'),
                 ('assigned', 'waiting'),
                 ('waiting', 'waiting'),
                 ('waiting', 'draft'),
@@ -1068,20 +1070,27 @@
                     'depends': ['state'],
                     },
                 'wait': {
-                    'invisible': ~Eval('state').in_(['assigned', 'waiting',
-                            'draft']),
-                    'icon': If(Eval('state') == 'assigned',
+                    'invisible': (
+                        ~(Eval('state').in_(['assigned', 'waiting', 'draft'])
+                            | ((Eval('state') == 'packed')
+                                & (Eval('warehouse_storage')
+                                    == Eval('warehouse_output'))))),
+                    'icon': If(Eval('state').in_(['assigned', 'packed']),
                         'tryton-back',
                         If(Eval('state') == 'waiting',
                             'tryton-clear',
                             'tryton-forward')),
-                    'depends': ['state'],
+                    'depends': [
+                        'state', 'warehouse_storage', 'warehouse_output'],
                     },
                 'pick': {
                     'invisible': If(
                         Eval('warehouse_storage') == Eval('warehouse_output'),
                         True,
-                        Eval('state') != 'assigned'),
+                        ~Eval('state').in_(['assigned', 'packed'])),
+                    'icon': If(Eval('state') == 'packed',
+                        'tryton-back',
+                        'tryton-forward'),
                     'depends': [
                         'state', 'warehouse_storage', 'warehouse_output'],
                     },
@@ -1242,6 +1251,7 @@
         Move.draft(moves)
         Move.delete([m for s in shipments for m in s.inventory_moves
                 if m.state in ('draft', 'cancelled')])
+        Move.draft([m for s in shipments for m in s.outgoing_moves])
 
         to_create = []
         for shipment in shipments:
@@ -1307,6 +1317,7 @@
                 m for s in shipments for m in s.inventory_moves
                 if m.state == 'staging'])
         Move.do([m for s in shipments for m in s.inventory_moves])
+        Move.draft([m for s in shipments for m in s.outgoing_moves])
         cls._sync_inventory_to_outgoing(shipments, quantity=True)
 
     @classmethod
diff -r 9dfa56e85ce4 -r 11631a8664bf view/shipment_out_form.xml
--- a/view/shipment_out_form.xml        Thu Sep 08 13:12:48 2022 +0200
+++ b/view/shipment_out_form.xml        Thu Sep 08 13:19:52 2022 +0200
@@ -41,7 +41,7 @@
         <button name="draft"/>
         <button name="wait"/>
         <button name="assign_wizard" icon="tryton-forward"/>
-        <button name="pick" icon="tryton-forward"/>
+        <button name="pick"/>
         <button name="pack" icon="tryton-forward"/>
         <button name="done" icon="tryton-ok"/>
     </group>

Reply via email to