When a quantity is increased in SO, the related picking is unreserved then re-assigned, we can just call assign, as we don't want to lose what has already been done in the picking. As the decreased quantity on SO is not propagated on move, not unreserving won't cause trouble.
19 lines
632 B
Python
19 lines
632 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):
|
|
res = super(SaleOrderLine, self)._action_launch_stock_rule()
|
|
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
|