修复表面工艺外协单状态

This commit is contained in:
jinling.yang
2024-06-30 19:16:48 +08:00
parent e124560089
commit 404a41294c
3 changed files with 5 additions and 3 deletions

View File

@@ -657,7 +657,7 @@ class MrpProduction(models.Model):
for production in self:
production.write({
'date_finished': fields.Datetime.now(),
'product_qty': production.qty_produced,
'product_qty': production.qty_produced if production.qty_produced < 1 else production.product_qty,
'priority': '0',
'is_locked': True,
'state': 'done',

View File

@@ -202,6 +202,7 @@ class ResMrpWorkOrder(models.Model):
[("programming", "编程"), ("clamping", "返工"), ("cutter", "刀具"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图"), ("other", "其他"), ], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因')
# is_send_program_again = fields.Boolean(string='是否重新下发NC程序', default=False)
@api.onchange('rfid_code')
@@ -861,7 +862,7 @@ class ResMrpWorkOrder(models.Model):
('location_dest_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'VL-SPOC')]).id),
('origin', '=', self.production_id.name)])
purchase = self.env['purchase.order'].search([('origin', '=', self.production_id.name)])
purchase = self.env['purchase.order'].search([('origin', 'ilike', self.production_id.name)])
if purchase and move_out:
move_out.write({'state': 'assigned'})
self.env['stock.move.line'].create(move_out.get_move_line(purchase, self))
@@ -1010,6 +1011,7 @@ class ResMrpWorkOrder(models.Model):
workorder.rfid_code_old = rfid_code
workorder.rfid_code = ''
if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺']:
logging.info('product_qty:%s' % record.production_id.product_qty)
for move_raw_id in record.production_id.move_raw_ids:
move_raw_id.quantity_done = move_raw_id.product_uom_qty
record.process_state = '已完工'

View File

@@ -211,7 +211,7 @@ class StockRule(models.Model):
'''
# productions._create_workorder()
#
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
(
p.move_dest_ids.procure_method != 'make_to_order' and not