Merge branch 'refs/heads/feature/搜索优化' into release/release_2.14
This commit is contained in:
@@ -41,13 +41,14 @@ class PurchaseRequest(models.Model):
|
|||||||
if lines:
|
if lines:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
for line_item in line.order_line:
|
for line_item in line.order_line:
|
||||||
product_id = line_item.product_id.id
|
if line_item.state == 'purchase':
|
||||||
qty = line_item.product_qty
|
product_id = line_item.product_id.id
|
||||||
product_rounding[product_id] = line_item.product_id.uom_id.rounding
|
qty = line_item.product_qty
|
||||||
if product_id in product_summary:
|
product_rounding[product_id] = line_item.product_id.uom_id.rounding
|
||||||
product_summary[product_id] += qty
|
if product_id in product_summary:
|
||||||
else:
|
product_summary[product_id] += qty
|
||||||
product_summary[product_id] = qty
|
else:
|
||||||
|
product_summary[product_id] = qty
|
||||||
|
|
||||||
# 校验产品数量
|
# 校验产品数量
|
||||||
discrepancies = []
|
discrepancies = []
|
||||||
@@ -63,7 +64,7 @@ class PurchaseRequest(models.Model):
|
|||||||
message = "产品数量不一致:\n"
|
message = "产品数量不一致:\n"
|
||||||
for product_id, required_qty, order_qty in discrepancies:
|
for product_id, required_qty, order_qty in discrepancies:
|
||||||
product_name = self.env['product.product'].browse(product_id).display_name # 获取产品名称
|
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 += "确认关闭?"
|
message += "确认关闭?"
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -227,22 +227,30 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# finish_move.move_dest_ids.move_line_ids.reserved_uom_qty = 0
|
# finish_move.move_dest_ids.move_line_ids.reserved_uom_qty = 0
|
||||||
else:
|
else:
|
||||||
next_workorder = sorted_workorders[position + 1]
|
next_workorder = sorted_workorders[position + 1]
|
||||||
next_state = next_workorder.state
|
# 持续获取下一个工单,直到找到一个不是返工的工单
|
||||||
if next_state not in ['pending', 'waiting', 'ready']:
|
while next_workorder and next_workorder.state == 'rework':
|
||||||
raise UserError('下工序已经开始,无法回退')
|
position += 1
|
||||||
if next_workorder.is_subcontract:
|
if position + 1 < len(sorted_workorders):
|
||||||
next_workorder.picking_ids.write({'state': 'waiting'})
|
next_workorder = sorted_workorders[position + 1]
|
||||||
next_workorder.state = 'pending'
|
|
||||||
self.time_ids.date_end = None
|
|
||||||
cur_workorder.state = 'progress'
|
|
||||||
cur_workorder.production_id.state = 'progress'
|
|
||||||
quality_check = self.env['quality.check'].search(
|
|
||||||
[('workorder_id', '=', self.id)])
|
|
||||||
for check_order in quality_check:
|
|
||||||
if check_order.point_id.is_inspect:
|
|
||||||
check_order.quality_state = 'waiting'
|
|
||||||
else:
|
else:
|
||||||
check_order.quality_state = 'none'
|
next_workorder = None
|
||||||
|
if next_workorder:
|
||||||
|
next_state = next_workorder.state
|
||||||
|
if next_state not in ['pending', 'waiting', 'ready']:
|
||||||
|
raise UserError('下工序已经开始,无法回退')
|
||||||
|
if next_workorder.is_subcontract:
|
||||||
|
next_workorder.picking_ids.write({'state': 'waiting'})
|
||||||
|
next_workorder.state = 'pending'
|
||||||
|
self.time_ids.date_end = None
|
||||||
|
cur_workorder.state = 'progress'
|
||||||
|
cur_workorder.production_id.state = 'progress'
|
||||||
|
quality_check = self.env['quality.check'].search(
|
||||||
|
[('workorder_id', '=', self.id)])
|
||||||
|
for check_order in quality_check:
|
||||||
|
if check_order.point_id.is_inspect:
|
||||||
|
check_order.quality_state = 'waiting'
|
||||||
|
else:
|
||||||
|
check_order.quality_state = 'none'
|
||||||
|
|
||||||
def _compute_working_users(self):
|
def _compute_working_users(self):
|
||||||
super()._compute_working_users()
|
super()._compute_working_users()
|
||||||
|
|||||||
Reference in New Issue
Block a user