Accept Merge Request #1123: (feature/sf物流方面缺陷与优化 -> develop)
Merge Request: 优化订单状态 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1123?initial=true
This commit is contained in:
@@ -30,13 +30,10 @@ class MrpProduction(models.Model):
|
|||||||
# ('completed', '已完工')
|
# ('completed', '已完工')
|
||||||
# ])
|
# ])
|
||||||
state = fields.Selection([
|
state = fields.Selection([
|
||||||
('draft', '待排程'),
|
('draft', '草稿'),
|
||||||
('confirmed', '待加工'),
|
('confirmed', '待排程'),
|
||||||
|
('pending_cam', '待加工'),
|
||||||
('progress', '加工中'),
|
('progress', '加工中'),
|
||||||
# ('pending_cam', '待装夹'),
|
|
||||||
# ('pending_processing', '待加工'),
|
|
||||||
# ('pending_era_cam', '待解除装夹'),
|
|
||||||
('completed', '已完工'),
|
|
||||||
('to_close', 'To Close'),
|
('to_close', 'To Close'),
|
||||||
('done', 'Done'),
|
('done', 'Done'),
|
||||||
('cancel', 'Cancelled')], string='State',
|
('cancel', 'Cancelled')], string='State',
|
||||||
@@ -82,7 +79,7 @@ class MrpProduction(models.Model):
|
|||||||
|
|
||||||
@api.depends(
|
@api.depends(
|
||||||
'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state',
|
'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state',
|
||||||
'workorder_ids.state', 'product_qty', 'qty_producing', 'schedule_state', 'process_state')
|
'workorder_ids.state', 'product_qty', 'qty_producing', 'schedule_state')
|
||||||
def _compute_state(self):
|
def _compute_state(self):
|
||||||
for production in self:
|
for production in self:
|
||||||
if not production.state or not production.product_uom_id:
|
if not production.state or not production.product_uom_id:
|
||||||
@@ -103,27 +100,6 @@ class MrpProduction(models.Model):
|
|||||||
elif not production.workorder_ids and float_compare(production.qty_producing, production.product_qty,
|
elif not production.workorder_ids and float_compare(production.qty_producing, production.product_qty,
|
||||||
precision_rounding=production.product_uom_id.rounding) >= 0:
|
precision_rounding=production.product_uom_id.rounding) >= 0:
|
||||||
production.state = 'to_close'
|
production.state = 'to_close'
|
||||||
elif any(wo_state in ('progress') for wo_state in production.workorder_ids.mapped('state')):
|
|
||||||
production.state = 'progress'
|
|
||||||
elif production.product_uom_id and not float_is_zero(production.qty_producing,
|
|
||||||
precision_rounding=production.product_uom_id.rounding):
|
|
||||||
production.state = 'progress'
|
|
||||||
elif any(not float_is_zero(move.quantity_done,
|
|
||||||
precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding)
|
|
||||||
for move in production.move_raw_ids):
|
|
||||||
production.state = 'progress'
|
|
||||||
|
|
||||||
# 新添加的状态逻辑
|
|
||||||
if production.state == 'to_close' and production.schedule_state == '未排':
|
|
||||||
production.state = 'draft'
|
|
||||||
elif production.state == 'to_close' and production.schedule_state == '已排':
|
|
||||||
production.state = 'confirmed'
|
|
||||||
# if production.schedule_state == '已完成':
|
|
||||||
# production.state = 'completed'
|
|
||||||
elif production.workorder_ids and production.workorder_ids[0].state == 'ready':
|
|
||||||
production.state = 'confirmed'
|
|
||||||
elif all(wo_state in ('done') for wo_state in production.workorder_ids.mapped('state')):
|
|
||||||
production.state = 'done'
|
|
||||||
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
||||||
production.state = 'progress'
|
production.state = 'progress'
|
||||||
elif production.product_uom_id and not float_is_zero(production.qty_producing,
|
elif production.product_uom_id and not float_is_zero(production.qty_producing,
|
||||||
@@ -131,20 +107,14 @@ class MrpProduction(models.Model):
|
|||||||
production.state = 'progress'
|
production.state = 'progress'
|
||||||
elif any(not float_is_zero(move.quantity_done,
|
elif any(not float_is_zero(move.quantity_done,
|
||||||
precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding)
|
precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding)
|
||||||
for move in production.move_raw_ids):
|
for move in production.move_raw_ids if move.product_id):
|
||||||
production.state = 'progress'
|
production.state = 'progress'
|
||||||
# if production.state == 'progress' and production.schedule_state == '已排' and production.process_state == '待装夹':
|
|
||||||
# # production.state = 'pending_processing'
|
# # 新添加的状态逻辑
|
||||||
# production.state = 'pending_cam'
|
if production.state == 'to_close' and production.schedule_state == '未排':
|
||||||
# if production.state == 'progress' and production.schedule_state == '已排' and production.process_state == '待加工':
|
production.state = 'confirmed'
|
||||||
# # if production.state == 'pending_cam' and production.process_state == '待加工':
|
elif production.state == 'to_close' and production.schedule_state == '已排':
|
||||||
# production.state = 'pending_processing'
|
production.state = 'pending_cam'
|
||||||
# elif production.state == 'progress' and production.process_state == '待解除装夹':
|
|
||||||
# production.state = 'pending_era_cam'
|
|
||||||
# elif production.state == 'progress' and production.process_state == '已完工':
|
|
||||||
# production.state = 'completed'
|
|
||||||
# elif production.state == 'progress' and production.work_order_state == '已完成':
|
|
||||||
# production.state = 'completed'
|
|
||||||
|
|
||||||
def action_check(self):
|
def action_check(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
<!-- <attribute name="statusbar_visible">draft,confirmed,progress,pending_processing,completed,done -->
|
<!-- <attribute name="statusbar_visible">draft,confirmed,progress,pending_processing,completed,done -->
|
||||||
<!-- </attribute> -->
|
<!-- </attribute> -->
|
||||||
<attribute name="statusbar_visible">
|
<attribute name="statusbar_visible">
|
||||||
draft,confirmed,progress,completed,done
|
confirmed,pending_cam,progress,done
|
||||||
</attribute>
|
</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//sheet//group//group[2]//label" position="before">
|
<xpath expr="//sheet//group//group[2]//label" position="before">
|
||||||
|
|||||||
Reference in New Issue
Block a user