Accept Merge Request #1694: (feature/消息提醒优化 -> develop)

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

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1694
This commit is contained in:
管欢
2024-12-31 13:32:34 +08:00
committed by Coding

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