diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css index edaa2bb4..20cb4c7e 100644 --- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css +++ b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.css @@ -22,6 +22,7 @@ width: 50px; height: 50px; margin-bottom: 5px; + margin-top: 15px; } .item-label { diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py index c6f40b37..e2ef6dbe 100644 --- a/sf_manufacturing/__manifest__.py +++ b/sf_manufacturing/__manifest__.py @@ -59,6 +59,7 @@ 'sf_manufacturing/static/src/js/agv_scheduling_cancel_confirm.js', 'sf_manufacturing/static/src/js/qr.js', 'sf_manufacturing/static/src/xml/qr.xml', + 'sf_manufacturing/static/src/scss/equipment_spacing.scss', ] }, diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 5a9ff77e..7a6c494b 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -311,13 +311,6 @@ class MrpProduction(models.Model): elif production.state == 'cancel' or (production.move_finished_ids and all( move.state == 'cancel' for move in production.move_finished_ids)): production.state = 'cancel' - elif ( - production.state == 'done' - or (production.move_raw_ids and all( - move.state in ('cancel', 'done') for move in production.move_raw_ids)) - and all(move.state in ('cancel', 'done') for move in production.move_finished_ids) - ): - production.state = 'done' elif production.workorder_ids and all( wo_state in ('done', 'cancel') for wo_state in production.workorder_ids.mapped('state')): production.state = 'to_close' @@ -351,18 +344,9 @@ class MrpProduction(models.Model): production.state = 'technology_to_confirmed' if production.state == 'confirmed' and production.schedule_state == '已排': production.state = 'pending_cam' - if production.state == 'progress': - if all(wo_state not in ('progress', 'done', 'rework', 'scrap') for wo_state in - production.workorder_ids.mapped('state')): - production.state = 'pending_cam' - if production.is_rework is True: - production.state = 'rework' if (production.state == 'rework' and production.tool_state == '0' and production.schedule_state == '已排' and production.is_rework is False): production.state = 'pending_cam' - # if production.state == 'pending_cam': - # if all(wo_state in 'done' for wo_state in production.workorder_ids.mapped('state')): - # production.state = 'done' if any((wo.test_results == '返工' and wo.state == 'done' and (production.programming_state in ['已编程'] or wo.individuation_page_PTD is True)) or (wo.is_rework is True and wo.state == 'done' and production.programming_state in ['编程中', '已编程']) @@ -377,6 +361,8 @@ class MrpProduction(models.Model): wo_state in ('done', 'rework', 'cancel') for wo_state in production.workorder_ids.mapped('state')): if production.state not in ['scrap', 'rework', 'cancel']: production.state = 'done' + elif production.state == 'done': + production.state = 'progress' # 退回调整 def technology_back_adjust(self): @@ -1540,15 +1526,16 @@ class MrpProduction(models.Model): product_id = self.env['product.product'].browse(vals['product_id']) is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工' is_customer_provided = product_id.is_customer_provided - if not is_custemer_group_id.get(is_customer_provided) and is_self_process: - is_custemer_group_id[is_customer_provided] = self.env["procurement.group"].create({'name': vals.get('name')}).id + key = f"{is_self_process}_{is_customer_provided}" + if not is_custemer_group_id.get(key): + is_custemer_group_id[key] = self.env["procurement.group"].create({'name': vals.get('name')}).id # if not (is_first_customer or is_first_not_customer) and is_self_process: # is_first = True # group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id if not vals.get('procurement_group_id'): if product_id.product_tmpl_id.single_manufacturing: - if product_id.categ_id.name == '成品' and is_self_process: - vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided] + if product_id.categ_id.name == '成品': + vals['procurement_group_id'] = is_custemer_group_id[key] continue if product_id.id not in product_group_id.keys(): procurement_group_vals = self._prepare_procurement_group_vals(vals) @@ -1558,7 +1545,7 @@ class MrpProduction(models.Model): else: vals['procurement_group_id'] = product_group_id[product_id.id] else: - vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided] + vals['procurement_group_id'] = is_custemer_group_id[key] return super(MrpProduction, self).create(vals_list) @api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id', diff --git a/sf_manufacturing/static/src/scss/equipment_spacing.scss b/sf_manufacturing/static/src/scss/equipment_spacing.scss new file mode 100644 index 00000000..5748345f --- /dev/null +++ b/sf_manufacturing/static/src/scss/equipment_spacing.scss @@ -0,0 +1,3 @@ +.my_custom_group_spacing { + margin-top: 30px; /* 调整组与上方元素的距离 */ +} \ No newline at end of file diff --git a/sf_manufacturing/views/purchase_order_view.xml b/sf_manufacturing/views/purchase_order_view.xml index 2b008b56..68a6864a 100644 --- a/sf_manufacturing/views/purchase_order_view.xml +++ b/sf_manufacturing/views/purchase_order_view.xml @@ -4,8 +4,14 @@ purchase.order.form.inherit.sf purchase.order - + + + {'readonly': [('state', '!=', 'draft')]} + + diff --git a/sf_manufacturing/views/sf_maintenance_equipment.xml b/sf_manufacturing/views/sf_maintenance_equipment.xml index 5ddf59b0..8eb69007 100644 --- a/sf_manufacturing/views/sf_maintenance_equipment.xml +++ b/sf_manufacturing/views/sf_maintenance_equipment.xml @@ -12,15 +12,16 @@ attrs="{'invisible': [('equipment_type', '!=', '机床')]}">