修复制造订单数量
This commit is contained in:
@@ -111,7 +111,8 @@ class MrpProduction(models.Model):
|
|||||||
production.state = 'progress'
|
production.state = 'progress'
|
||||||
|
|
||||||
# # 新添加的状态逻辑
|
# # 新添加的状态逻辑
|
||||||
if (production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排':
|
if (
|
||||||
|
production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排':
|
||||||
production.state = 'confirmed'
|
production.state = 'confirmed'
|
||||||
elif production.state == 'to_close' and production.schedule_state == '已排':
|
elif production.state == 'to_close' and production.schedule_state == '已排':
|
||||||
production.state = 'pending_cam'
|
production.state = 'pending_cam'
|
||||||
@@ -120,7 +121,6 @@ class MrpProduction(models.Model):
|
|||||||
if all(wo_state not in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
if all(wo_state not in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
||||||
production.state = 'pending_cam'
|
production.state = 'pending_cam'
|
||||||
|
|
||||||
|
|
||||||
def action_check(self):
|
def action_check(self):
|
||||||
"""
|
"""
|
||||||
审核启用
|
审核启用
|
||||||
@@ -630,9 +630,10 @@ class MrpProduction(models.Model):
|
|||||||
})
|
})
|
||||||
|
|
||||||
for production in self:
|
for production in self:
|
||||||
|
logging.info('qty_produced:%s' % production.qty_produced)
|
||||||
production.write({
|
production.write({
|
||||||
'date_finished': fields.Datetime.now(),
|
'date_finished': fields.Datetime.now(),
|
||||||
'product_qty': production.qty_produced if production.qty_produced < 1 else production.product_qty,
|
'product_qty': production.product_qty if production.qty_produced < 1.0 else production.qty_produced,
|
||||||
'priority': '0',
|
'priority': '0',
|
||||||
'is_locked': True,
|
'is_locked': True,
|
||||||
'state': 'done',
|
'state': 'done',
|
||||||
@@ -658,6 +659,7 @@ class MrpProduction(models.Model):
|
|||||||
if any(mo.show_allocation for mo in self):
|
if any(mo.show_allocation for mo in self):
|
||||||
action = self.action_view_reception_report()
|
action = self.action_view_reception_report()
|
||||||
return action
|
return action
|
||||||
|
logging.info('last-product_qty:%s' % production.product_qty)
|
||||||
return True
|
return True
|
||||||
context = self.env.context.copy()
|
context = self.env.context.copy()
|
||||||
context = {k: v for k, v in context.items() if not k.startswith('default_')}
|
context = {k: v for k, v in context.items() if not k.startswith('default_')}
|
||||||
|
|||||||
@@ -1017,7 +1017,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
record.production_id.process_state = '已完工'
|
record.production_id.process_state = '已完工'
|
||||||
if record.routing_type in ['解除装夹', '表面工艺']:
|
if record.routing_type in ['解除装夹', '表面工艺']:
|
||||||
raw_move = self.env['stock.move'].sudo().search(
|
raw_move = self.env['stock.move'].sudo().search(
|
||||||
[('origin', '=', record.production_id.name), ('procure_method', '=', 'make_to_order'),
|
[('origin', '=', record.production_id.name),
|
||||||
|
('procure_method', 'in', ['make_to_order', 'make_to_stock']),
|
||||||
('state', '!=', 'done')])
|
('state', '!=', 'done')])
|
||||||
if raw_move:
|
if raw_move:
|
||||||
raw_move.write({'state': 'done'})
|
raw_move.write({'state': 'done'})
|
||||||
|
|||||||
Reference in New Issue
Block a user