优化报废

This commit is contained in:
jinling.yang
2024-08-15 17:31:37 +08:00
parent cccc2f8493
commit e2d7576a5e
4 changed files with 47 additions and 9 deletions

View File

@@ -796,7 +796,7 @@ class MrpProduction(models.Model):
# 返工
def button_scrap_new(self):
cloud_programming = self._cron_get_programming_state()
# cloud_programming = self._cron_get_programming_state()
return {
'name': _('报废'),
'type': 'ir.actions.act_window',
@@ -805,7 +805,8 @@ class MrpProduction(models.Model):
'target': 'new',
'context': {
'default_production_id': self.id,
'default_programming_state': cloud_programming['programming_state']
'default_is_reprogramming': False,
'default_programming_state': '已下发'
}
}
@@ -943,8 +944,14 @@ class MrpProduction(models.Model):
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(
self.company_id).create(
values)
# moves_values = [{''}]
# moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(moves_values)
# self.env['stock.move'].sudo().create(productions._get_moves_raw_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 p.move_raw_ids and not p.workorder_ids)).action_confirm()
productions.programming_no = self.programming_no
scarp_process_parameter_workorder = self.env['mrp.workorder'].search(
[('surface_technics_parameters_id', '!=', False), ('production_id', '=', self.id),
@@ -1015,10 +1022,6 @@ class MrpProduction(models.Model):
else:
productions.programming_state = '编程中'
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 p.move_raw_ids and not p.workorder_ids)).action_confirm()
for production in productions:
origin_production = production.move_dest_ids and production.move_dest_ids[
0].raw_material_production_id or False
@@ -1065,6 +1068,7 @@ class MrpProduction(models.Model):
def create_production1_values(self, production):
production_values_str = {'origin': production.origin,
'product_id': production.product_id.id,
'programming_state': '已编程',
'product_description_variants': production.product_description_variants,
'product_qty': production.product_qty,
'product_uom_id': production.product_uom_id.id,