trytond-patches/issue10467.diff

46 lines
1.8 KiB
Diff

diff --git a/trytond/trytond/modules/stock_lot/product.py b/trytond/trytond/modules/stock_lot/product.py
index e8a01ec..8e3b5d9 100644
--- a/trytond/trytond/modules/stock_lot/product.py
+++ b/trytond/trytond/modules/stock_lot/product.py
@@ -13,12 +13,13 @@ class Template(metaclass=PoolMeta):
__name__ = 'product.template'
lot_required = fields.MultiSelection([
- ('supplier', "Supplier"),
('customer', "Customer"),
('lost_found', "Lost and Found"),
- ('storage', "Storage"),
('production', "Production"),
+ ('storage', "Storage"),
+ ('supplier', "Supplier"),
], "Lot Required",
+ sort=False,
help='The type of location for which lot is required.',
states={
'invisible': ~Eval('type').in_(['goods', 'assets']),
diff --git a/trytond/trytond/modules/stock_lot/stock.py b/trytond/trytond/modules/stock_lot/stock.py
index 699f336..d683f87 100644
--- a/trytond/trytond/modules/stock_lot/stock.py
+++ b/trytond/trytond/modules/stock_lot/stock.py
@@ -116,6 +116,20 @@ class Move(metaclass=PoolMeta):
},
depends=['state', 'product'])
+ @classmethod
+ def assign_try(cls, moves, with_childs=True, grouping=('product',)):
+ lot_moves = []
+ product_moves = []
+ for move in moves:
+ if move.lot:
+ lot_moves.append(move)
+ else:
+ product_moves.append(move)
+ return (super(Move, cls).assign_try(lot_moves,
+ with_childs=with_childs, grouping=('product', 'lot'))
+ & super(Move, cls).assign_try(product_moves,
+ with_childs=with_childs, grouping=grouping))
+
def check_lot(self):
"Check if lot is required"
if (self.state == 'done'