修复制造订单数量
This commit is contained in:
@@ -111,7 +111,8 @@ class MrpProduction(models.Model):
|
||||
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'
|
||||
elif production.state == 'to_close' and production.schedule_state == '已排':
|
||||
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')):
|
||||
production.state = 'pending_cam'
|
||||
|
||||
|
||||
def action_check(self):
|
||||
"""
|
||||
审核启用
|
||||
@@ -630,9 +630,10 @@ class MrpProduction(models.Model):
|
||||
})
|
||||
|
||||
for production in self:
|
||||
logging.info('qty_produced:%s' % production.qty_produced)
|
||||
production.write({
|
||||
'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',
|
||||
'is_locked': True,
|
||||
'state': 'done',
|
||||
@@ -658,6 +659,7 @@ class MrpProduction(models.Model):
|
||||
if any(mo.show_allocation for mo in self):
|
||||
action = self.action_view_reception_report()
|
||||
return action
|
||||
logging.info('last-product_qty:%s' % production.product_qty)
|
||||
return True
|
||||
context = self.env.context.copy()
|
||||
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 = '已完工'
|
||||
if record.routing_type in ['解除装夹', '表面工艺']:
|
||||
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')])
|
||||
if raw_move:
|
||||
raw_move.write({'state': 'done'})
|
||||
|
||||
Reference in New Issue
Block a user