99class Picking (models .Model ):
1010 _inherit = "stock.picking"
1111
12- zero_received_move_ids = fields .One2many (
13- "stock.move" ,
14- string = "Stock moves that were not received" ,
12+ zero_received_move_line_ids = fields .One2many (
13+ "stock.move.line " ,
14+ string = "Stock move lines that were not received" ,
1515 compute = "_compute_move_discrepancy" ,
1616 )
17- zero_expected_move_ids = fields .One2many (
18- "stock.move" ,
19- string = "Stock moves of which some were received, but none were expected" ,
17+ zero_expected_move_line_ids = fields .One2many (
18+ "stock.move.line " ,
19+ string = "Stock move lines of which some were received, but none were expected" ,
2020 compute = "_compute_move_discrepancy" ,
2121 )
22- too_few_received_move_ids = fields .One2many (
23- "stock.move" ,
24- string = "Stock moves of which too few were received" ,
22+ too_few_received_move_line_ids = fields .One2many (
23+ "stock.move.line " ,
24+ string = "Stock move lines of which too few were received" ,
2525 compute = "_compute_move_discrepancy" ,
2626 )
27- too_many_received_move_ids = fields .One2many (
28- "stock.move" ,
29- string = "Stock moves of which too many were received" ,
27+ too_many_received_move_line_ids = fields .One2many (
28+ "stock.move.line " ,
29+ string = "Stock move lines of which too many were received" ,
3030 compute = "_compute_move_discrepancy" ,
3131 )
3232
3333 @api .multi
34- @api .depends ("move_lines " )
34+ @api .depends ("move_line_ids " )
3535 def _compute_move_discrepancy (self ):
3636 for picking in self :
3737 # The following filter is also used in upstream action_done()
38- filtered_moves = picking .mapped ("move_lines " ).filtered (
39- lambda move : move .state
38+ filtered_moves = picking .mapped ("move_line_ids " ).filtered (
39+ lambda line : line .state
4040 in [
4141 "draft" ,
4242 "waiting" ,
@@ -46,19 +46,19 @@ def _compute_move_discrepancy(self):
4646 ]
4747 )
4848
49- picking .zero_received_move_ids = filtered_moves .filtered (
50- lambda move : move . quantity_done == 0 and move .product_qty
49+ picking .zero_received_move_line_ids = filtered_moves .filtered (
50+ lambda line : line . qty_done == 0 and line .product_qty
5151 )
52- picking .zero_expected_move_ids = filtered_moves .filtered (
53- lambda move : move . quantity_done and move .product_qty == 0
52+ picking .zero_expected_move_line_ids = filtered_moves .filtered (
53+ lambda line : line . qty_done and line .product_qty == 0
5454 )
55- picking .too_few_received_move_ids = filtered_moves .filtered (
56- lambda move : move . quantity_done != 0
57- and move . quantity_done < move .product_qty
55+ picking .too_few_received_move_line_ids = filtered_moves .filtered (
56+ lambda line : line . qty_done != 0
57+ and line . qty_done < line .product_qty
5858 )
59- picking .too_many_received_move_ids = filtered_moves .filtered (
60- lambda move : move . quantity_done > move .product_qty
61- and move .product_qty != 0
59+ picking .too_many_received_move_line_ids = filtered_moves .filtered (
60+ lambda line : line . qty_done > line .product_qty
61+ and line .product_qty != 0
6262 )
6363
6464 @api .multi
@@ -115,10 +115,10 @@ def _notify_incorrect_delivery(self):
115115 for picking in self :
116116 if not any (
117117 (
118- picking .zero_received_move_ids ,
119- picking .zero_expected_move_ids ,
120- picking .too_few_received_move_ids ,
121- picking .too_many_received_move_ids ,
118+ picking .zero_received_move_line_ids ,
119+ picking .zero_expected_move_line_ids ,
120+ picking .too_few_received_move_line_ids ,
121+ picking .too_many_received_move_line_ids ,
122122 )
123123 ):
124124 continue
0 commit comments