修复成品调拨出库订单的状态没变

This commit is contained in:
guanhuan
2024-12-31 13:08:00 +08:00
parent 78a456849c
commit 39ed32f3e9

View File

@@ -654,7 +654,10 @@ class StockPicking(models.Model):
if self.location_id.name == '成品存货区' and self.location_dest_id.name == '客户':
sale_id = self.env['sale.order'].sudo().search(
[('name', '=', self.origin)])
if sale_id and res:
stock_picking_list = self.env['stock.picking'].sudo().search(
[('id', 'in', sale_id.picking_ids.ids)])
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
if sale_id and not stock_picking:
sale_id.write({'state': 'delivered'})
return res