add lot to grouping when assign stock.move if its necessary

This commit is contained in:
?ngel ?lvarez 2018-07-10 13:05:29 +02:00
parent ef7ca54af2
commit 09c0b8230c
2 changed files with 25 additions and 0 deletions

24
issue10467.diff Normal file
View File

@ -0,0 +1,24 @@
diff -r 8a6a82c717d6 stock.py
--- a/trytond/trytond/modules/stock_lot/stock.py Tue Jul 10 12:57:12 2018 +0200
+++ b/trytond/trytond/modules/stock_lot/stock.py Tue Jul 10 12:58:45 2018 +0200
@@ -159,6 +159,20 @@
'lot_required': 'Lot is required for move of product "%s".',
})
+ @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'

1
series
View File

@ -16,3 +16,4 @@ search_warehouse.diff #[stock] search function for warehouse.
stock_consignment_create_invoice_lines_on_move_done.diff # [stock_consignment] Task #034628: stock_consignment only create invoice lines on move done
issue240_631.diff # [stock_lot] stock_by_locations get all locations with that lot.
issue10467.diff # stock_lot: add lot to grouping if lot it's required on product