Merge branch 'refs/heads/feature/搜索优化' into release/release_2.14

This commit is contained in:
guanhuan
2025-06-09 17:56:50 +08:00
2 changed files with 32 additions and 23 deletions

View File

@@ -41,6 +41,7 @@ class PurchaseRequest(models.Model):
if lines:
for line in lines:
for line_item in line.order_line:
if line_item.state == 'purchase':
product_id = line_item.product_id.id
qty = line_item.product_qty
product_rounding[product_id] = line_item.product_id.uom_id.rounding
@@ -63,7 +64,7 @@ class PurchaseRequest(models.Model):
message = "产品数量不一致:\n"
for product_id, required_qty, order_qty in discrepancies:
product_name = self.env['product.product'].browse(product_id).display_name # 获取产品名称
message += f"产品 {product_name},需求数量 {required_qty},关联采购订单数量 {order_qty}(含询价状态)\n"
message += f"产品 {product_name},需求数量 {required_qty},关联采购订单确认的数量 {order_qty},不一致,确认关闭?\n"
# 添加确认框
message += "确认关闭?"
return {

View File

@@ -227,6 +227,14 @@ class ResMrpWorkOrder(models.Model):
# finish_move.move_dest_ids.move_line_ids.reserved_uom_qty = 0
else:
next_workorder = sorted_workorders[position + 1]
# 持续获取下一个工单,直到找到一个不是返工的工单
while next_workorder and next_workorder.state == 'rework':
position += 1
if position + 1 < len(sorted_workorders):
next_workorder = sorted_workorders[position + 1]
else:
next_workorder = None
if next_workorder:
next_state = next_workorder.state
if next_state not in ['pending', 'waiting', 'ready']:
raise UserError('下工序已经开始,无法回退')