Files
odoo_source/addons/procurement_jit/sale.py
T
Arnold Moyaux cb618e9a99 [IMP] stock: _assign_picking in batch
Only search once for batch of moves that should be assign
to the same picking and assign them all at once.
Since the moves are processed in batch for a picking
commit 8fe8ca9 is not needed anymore.

closes odoo/odoo#30699
2019-02-14 11:09:07 +00:00

19 lines
713 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
@api.multi
def _action_launch_stock_rule(self, previous_product_uom_qty=False):
res = super(SaleOrderLine, self)._action_launch_stock_rule(previous_product_uom_qty=previous_product_uom_qty)
orders = list(set(x.order_id for x in self))
for order in orders:
reassign = order.picking_ids.filtered(lambda x: x.state=='confirmed' or (x.state in ['waiting', 'assigned'] and not x.printed))
if reassign:
reassign.action_assign()
return res