diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml
index 6ce80937..ac17af6a 100644
--- a/sf_base/views/tool_views.xml
+++ b/sf_base/views/tool_views.xml
@@ -112,6 +112,8 @@
+
+
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index fb458f28..1edf529d 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -69,6 +69,50 @@ class ResMrpWorkOrder(models.Model):
delivery_warning = fields.Selection([('normal', '正常'), ('warning', '告警'), ('overdue', '逾期')], string='时效',
tracking=True)
+ back_button_display = fields.Boolean(default=False, compute='_compute_back_button_display', store=True)
+
+ @api.depends('state')
+ def _compute_back_button_display(self):
+ for record in self:
+ sorted_workorders = record.production_id.workorder_ids.filtered(lambda w: w.state != 'cancel').sorted(
+ key=lambda w: w.sequence)
+ if not sorted_workorders:
+ continue
+ position = next((idx for idx, workorder in enumerate(sorted_workorders) if workorder.id == record.id), -1)
+ cur_workorder = sorted_workorders[position]
+ if position == len(sorted_workorders) - 1:
+ picking_ids = cur_workorder.production_id.sale_order_id.picking_ids
+ finished_product_area = picking_ids.filtered(
+ lambda picking: picking.location_dest_id.name == '成品存货区' and picking.state == 'done'
+ )
+ if finished_product_area:
+ moves = self.env['stock.move'].search([
+ ('name', '=', cur_workorder.production_id.name),
+ ('state', '!=', 'cancel')
+ ])
+ finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None)
+ if not finish_move and not cur_workorder.is_subcontract:
+ record.back_button_display = True
+ else:
+ record.back_button_display = any(
+ finish_move.move_dest_ids.ids not in move.ids and record.state == 'done'
+ for picking in finished_product_area
+ for move in picking.move_ids
+ )
+ else:
+ if record.state == 'done':
+ record.back_button_display = True
+ else:
+ record.back_button_display = False
+ else:
+ next_workorder = sorted_workorders[position + 1]
+ next_state = next_workorder.state
+ if ((next_state == 'ready' and not next_workorder.is_subcontract) or (next_workorder.state == 'pending' and next_workorder.is_subcontract)) and cur_workorder.state == 'done':
+ record.back_button_display = True
+ else:
+ record.back_button_display = False
+ if cur_workorder.is_subcontract:
+ record.back_button_display = False
date_planned_start = fields.Datetime(tracking=True)
@api.depends('processing_panel')
@@ -86,6 +130,84 @@ class ResMrpWorkOrder(models.Model):
manual_quotation = fields.Boolean('人工编程', default=False, compute=_compute_manual_quotation, store=True)
+ def button_back(self):
+ if self.production_id.state == 'rework':
+ raise UserError('制造订单为返工时不能进行工单回退')
+ sorted_workorders = self.production_id.workorder_ids.filtered(lambda w: w.state != 'cancel').sorted(
+ key=lambda w: w.sequence)
+ position = next((idx for idx, workorder in enumerate(sorted_workorders) if workorder.id == self.id), -1)
+ cur_workorder = sorted_workorders[position]
+ if position == len(sorted_workorders) - 1:
+ # 末工序
+ picking_ids = cur_workorder.production_id.sale_order_id.picking_ids
+ finished_product_area = picking_ids.filtered(
+ lambda picking: picking.location_dest_id.name == '成品存货区' and picking.state == 'done'
+ )
+ moves = self.env['stock.move'].search([
+ ('name', '=', cur_workorder.production_id.name),
+ ('state', '!=', 'cancel')
+ ])
+ finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None) or []
+ if any(
+ finish_move.move_dest_ids.ids in move.ids
+ for picking in finished_product_area
+ for move in picking.move_ids
+ ):
+ raise UserError('已入库,无法回退')
+ else:
+ move_finished = cur_workorder.production_id.move_finished_ids
+ random_element = random.choice(move_finished)
+ moves = self.env['stock.move'].search([
+ ('name', '=', random_element.name),
+ ('state', '!=', 'cancel')
+ ])
+ move_lines = self.env['stock.move.line'].search([
+ ('reference', '=', random_element.name),
+ ('state', '!=', 'cancel')
+ ])
+ moves.state = 'assigned'
+ external_assistance = move_lines.filtered(
+ lambda picking: picking.location_id.name != '外协线边仓'
+ )
+ external_assistance.state = 'assigned'
+ # move_lines.state = 'assigned'
+ self.time_ids.date_end = None
+ cur_workorder.state = 'progress'
+ cur_workorder.production_id.state = 'progress'
+ quality_check = self.env['quality.check'].search(
+ [('workorder_id', '=', self.id)])
+ for check_order in quality_check:
+ if check_order.point_id.is_inspect:
+ check_order.state = 'waiting'
+ else:
+ check_order.state = 'none'
+ # move_dest_ids
+ finished_quants = moves.mapped('move_line_ids.lot_id.quant_ids')
+ finished_quants.quantity = 0
+ finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None)
+ finish_move.move_dest_ids.reserved_availability = 0
+ finish_move.move_dest_ids.move_line_ids.state = 'draft'
+ finish_move.move_dest_ids.move_line_ids.unlink()
+ # finish_move.move_dest_ids.move_line_ids.reserved_uom_qty = 0
+ else:
+ next_workorder = sorted_workorders[position + 1]
+ next_state = next_workorder.state
+ if next_state not in ['pending', 'waiting', 'ready']:
+ raise UserError('下工序已经开始,无法回退')
+ if next_workorder.is_subcontract:
+ next_workorder.picking_ids.write({'state': 'waiting'})
+ next_workorder.state = 'pending'
+ self.time_ids.date_end = None
+ cur_workorder.state = 'progress'
+ cur_workorder.production_id.state = 'progress'
+ quality_check = self.env['quality.check'].search(
+ [('workorder_id', '=', self.id)])
+ for check_order in quality_check:
+ if check_order.point_id.is_inspect:
+ check_order.state = 'waiting'
+ else:
+ check_order.state = 'none'
+
def _compute_working_users(self):
super()._compute_working_users()
for item in self:
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index 419eec50..dab95f1b 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -48,6 +48,7 @@
+
@@ -58,6 +59,10 @@
{'invisible': [('state', '!=', 'ready')]}
+
+
+
+
{'invisible':
['|',("user_permissions","=",False),("name","=","获取CNC加工程序")]}
diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py
index 9115bc65..16b0da2f 100644
--- a/sf_mrs_connect/models/sync_common.py
+++ b/sf_mrs_connect/models/sync_common.py
@@ -1968,8 +1968,7 @@ class CuttingSpeed(models.Model):
self.create({
'name': item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'execution_standard_id': self.env['sf.international.standards'].search(
[('code', '=', item['execution_standard_code'])]).id,
'material_name_id': self.env['sf.materials.model'].search(
@@ -1989,8 +1988,7 @@ class CuttingSpeed(models.Model):
else:
cutting_speed.write({
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'execution_standard_id': self.env['sf.international.standards'].search(
[('code', '=', item['execution_standard_code'])]).id,
'material_name_id': self.env['sf.materials.model'].search(
@@ -2023,8 +2021,7 @@ class CuttingSpeed(models.Model):
self.create({
'name': item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'execution_standard_id': self.env['sf.international.standards'].search(
[('code', '=', item['execution_standard_code'])]).id,
'material_name_id': self.env['sf.materials.model'].search(
@@ -2044,8 +2041,7 @@ class CuttingSpeed(models.Model):
else:
cutting_speed.write({
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'execution_standard_id': self.env['sf.international.standards'].search(
[('code', '=', item['execution_standard_code'])]).id,
'material_name_id': self.env['sf.materials.model'].search(
@@ -2124,8 +2120,7 @@ class CuttingSpeed(models.Model):
self.create({
'name': item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'materials_type_id': self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_type_code'])]).id,
'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search(
@@ -2137,8 +2132,7 @@ class CuttingSpeed(models.Model):
else:
feed_per_tooth.write({
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'materials_type_id': self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_type_code'])]).id,
'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search(
@@ -2165,8 +2159,7 @@ class CuttingSpeed(models.Model):
self.create({
'name': item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'materials_type_id': self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_type_code'])]).id,
'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search(
@@ -2178,8 +2171,7 @@ class CuttingSpeed(models.Model):
else:
feed_per_tooth.write({
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', item['standard_library_code'])]).id,
'materials_type_id': self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_type_code'])]).id,
'cutting_width_depth_id': self.env['sf.cutting.width.depth'].search(
@@ -2207,7 +2199,7 @@ class Cutting_tool_standard_library(models.Model):
if result['status'] == 1:
for item in result['cutting_tool_standard_library_yesterday_list']:
cutting_tool_standard_library = self.search(
- [("code", '=', item['code'].replace("JKM", result['factory_short_name'])),
+ [("code", '=', item['code']),
('active', 'in', [True, False])])
cutting_tool_type = self.env['sf.cutting.tool.type'].search(
[("code", '=', item['cutting_tool_type_code'])])
@@ -2218,7 +2210,7 @@ class Cutting_tool_standard_library(models.Model):
brand = self.env['sf.machine.brand'].search([("code", '=', item['brand_code'])])
if not cutting_tool_standard_library:
self.create({
- "code": item['code'].replace("JKM", result['factory_short_name']),
+ "code": item['code'],
"name": item['name'],
"cutting_tool_material_id": cutting_tool_material.id,
"cutting_tool_type_id": cutting_tool_type.id,
@@ -2240,9 +2232,9 @@ class Cutting_tool_standard_library(models.Model):
'maintenance.equipment.image'].search(
[('name', '=', item['fit_blade_shape'])]).id,
"chuck_id": False if not item['chuck_code'] else self.search(
- [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['chuck_code'])]).id,
"handle_id": False if not item['handle_code'] else self.search(
- [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['handle_code'])]).id,
"suitable_machining_method_ids": [(6, 0, [])] if not item.get(
'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids(
item['suitable_machining_methods']),
@@ -2282,9 +2274,9 @@ class Cutting_tool_standard_library(models.Model):
'maintenance.equipment.image'].search(
[('name', '=', item['fit_blade_shape'])]).id,
"chuck_id": False if not item['chuck_code'] else self.search(
- [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['chuck_code'])]).id,
"handle_id": False if not item['handle_code'] else self.search(
- [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['handle_code'])]).id,
"suitable_machining_method_ids": [(6, 0, [])] if not item.get(
'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids(
item['suitable_machining_methods']),
@@ -2314,7 +2306,7 @@ class Cutting_tool_standard_library(models.Model):
if result['status'] == 1:
for item in result['cutting_tool_standard_library_all_list']:
cutting_tool_standard_library = self.search(
- [("code", '=', item['code'].replace("JKM", result['factory_short_name'])),
+ [("code", '=', item['code']),
("active", 'in', [True, False])])
cutting_tool_type = self.env['sf.cutting.tool.type'].search(
[("code", '=', item['cutting_tool_type_code'])])
@@ -2325,7 +2317,7 @@ class Cutting_tool_standard_library(models.Model):
brand = self.env['sf.machine.brand'].search([("code", '=', item['brand_code'])])
if not cutting_tool_standard_library:
self.create({
- "code": item['code'].replace("JKM", result['factory_short_name']),
+ "code": item['code'],
"name": item['name'],
"cutting_tool_material_id": cutting_tool_material.id,
"cutting_tool_type_id": cutting_tool_type.id,
@@ -2347,9 +2339,9 @@ class Cutting_tool_standard_library(models.Model):
'maintenance.equipment.image'].search(
[('name', '=', item['fit_blade_shape'])]).id,
"chuck_id": False if not item['chuck_code'] else self.search(
- [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['chuck_code'])]).id,
"handle_id": False if not item['handle_code'] else self.search(
- [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['handle_code'])]).id,
"suitable_machining_method_ids": [(6, 0, [])] if not item.get(
'suitable_machining_method') else self.env['maintenance.equipment.image']._get_ids(
item['suitable_machining_method']),
@@ -2389,9 +2381,9 @@ class Cutting_tool_standard_library(models.Model):
'maintenance.equipment.image'].search(
[('name', '=', item['fit_blade_shape'])]).id,
"chuck_id": False if not item['chuck_code'] else self.search(
- [('code', '=', item['chuck_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['chuck_code'])]).id,
"handle_id": False if not item['handle_code'] else self.search(
- [('code', '=', item['handle_code'].replace("JKM", result['factory_short_name']))]).id,
+ [('code', '=', item['handle_code'])]).id,
"suitable_machining_method_ids": [(6, 0, [])] if not item.get(
'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids(
item['suitable_machining_methods']),
@@ -2442,8 +2434,7 @@ class CuttingToolBasicParameters(models.Model):
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
[(
'code', '=',
- integral_tool_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ integral_tool_item['standard_library_code'])]).id,
'total_length': integral_tool_item['total_length'],
'blade_diameter': integral_tool_item['blade_diameter'],
'blade_length': integral_tool_item['blade_length'],
@@ -2469,8 +2460,7 @@ class CuttingToolBasicParameters(models.Model):
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
[(
'code', '=',
- integral_tool_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ integral_tool_item['standard_library_code'])]).id,
'total_length': integral_tool_item['total_length'],
'blade_diameter': integral_tool_item['blade_diameter'],
'blade_length': integral_tool_item['blade_length'],
@@ -2503,8 +2493,7 @@ class CuttingToolBasicParameters(models.Model):
'code': blade_item['code'],
'cutting_tool_type': '刀片',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', blade_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', blade_item['standard_library_code'])]).id,
'length': blade_item['length'],
'thickness': blade_item['thickness'],
'cutting_blade_length': blade_item['cutting_blade_length'],
@@ -2534,8 +2523,7 @@ class CuttingToolBasicParameters(models.Model):
self.search([('code', '=', blade_item['code'])]).write({
'name': blade_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', blade_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', blade_item['standard_library_code'])]).id,
'length': blade_item['length'],
'thickness': blade_item['thickness'],
'cutting_blade_length': blade_item['cutting_blade_length'],
@@ -2574,8 +2562,7 @@ class CuttingToolBasicParameters(models.Model):
'code': chuck_item['code'],
'cutting_tool_type': '夹头',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', chuck_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', chuck_item['standard_library_code'])]).id,
'er_size_model': chuck_item['size_model'],
'min_clamping_diameter': chuck_item['clamping_diameter_min'],
'max_clamping_diameter': chuck_item['clamping_diameter_max'],
@@ -2594,8 +2581,7 @@ class CuttingToolBasicParameters(models.Model):
self.search([('code', '=', chuck_item['code'])]).write({
'name': chuck_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', chuck_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', chuck_item['standard_library_code'])]).id,
'er_size_model': chuck_item['size_model'],
'min_clamping_diameter': chuck_item['clamping_diameter_min'],
'max_clamping_diameter': chuck_item['clamping_diameter_max'],
@@ -2624,8 +2610,7 @@ class CuttingToolBasicParameters(models.Model):
'code': cutter_arbor_item['code'],
'cutting_tool_type': '刀杆',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_arbor_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_arbor_item['standard_library_code'])]).id,
'height': cutter_arbor_item['height'],
'width': cutter_arbor_item['width'],
'total_length': cutter_arbor_item['total_length'],
@@ -2643,8 +2628,7 @@ class CuttingToolBasicParameters(models.Model):
'installing_structure': cutter_arbor_item['mounting_structure'],
'blade_id': False if not cutter_arbor_item['fit_blade_model_code'] else self.env[
'sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_arbor_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_arbor_item['fit_blade_model_code'])]).id,
'tool_shim': cutter_arbor_item['fit_knife_pad_model'],
'cotter_pin': cutter_arbor_item['fit_pin_model'],
'pressing_plate': cutter_arbor_item['fit_plate_model'],
@@ -2656,8 +2640,7 @@ class CuttingToolBasicParameters(models.Model):
self.search([('code', '=', cutter_arbor_item['code'])]).write({
'name': cutter_arbor_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_arbor_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_arbor_item['standard_library_code'])]).id,
'height': cutter_arbor_item['height'],
'width': cutter_arbor_item['width'],
'total_length': cutter_arbor_item['total_length'],
@@ -2675,8 +2658,7 @@ class CuttingToolBasicParameters(models.Model):
'installing_structure': cutter_arbor_item['mounting_structure'],
'blade_id': False if not cutter_arbor_item['fit_blade_model_code'] else self.env[
'sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_arbor_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_arbor_item['fit_blade_model_code'])]).id,
'tool_shim': cutter_arbor_item['fit_knife_pad_model'],
'cotter_pin': cutter_arbor_item['fit_pin_model'],
'pressing_plate': cutter_arbor_item['fit_plate_model'],
@@ -2698,8 +2680,7 @@ class CuttingToolBasicParameters(models.Model):
'code': cutter_head_item['code'],
'cutting_tool_type': '刀盘',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_head_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_head_item['standard_library_code'])]).id,
'install_blade_tip_num': cutter_head_item['number_blade_installed'],
'blade_diameter': cutter_head_item['blade_diameter'],
'cutter_head_diameter': cutter_head_item['cutter_diameter'],
@@ -2712,8 +2693,7 @@ class CuttingToolBasicParameters(models.Model):
'installing_structure': cutter_head_item['mounting_structure'],
'blade_id': False if not cutter_head_item['fit_blade_model_code'] else self.env[
'sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_head_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_head_item['fit_blade_model_code'])]).id,
'screw': cutter_head_item['fit_screw_model'],
'spanner': cutter_head_item['fit_wrench_model'],
'is_cooling_hole': cutter_head_item['is_cooling_hole'],
@@ -2724,8 +2704,7 @@ class CuttingToolBasicParameters(models.Model):
self.search([('code', '=', cutter_head_item['code'])]).write({
'name': cutter_head_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_head_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_head_item['standard_library_code'])]).id,
'install_blade_tip_num': cutter_head_item['number_blade_installed'],
'blade_diameter': cutter_head_item['blade_diameter'],
'cutter_head_diameter': cutter_head_item['cutter_diameter'],
@@ -2738,8 +2717,7 @@ class CuttingToolBasicParameters(models.Model):
'installing_structure': cutter_head_item['mounting_structure'],
'blade_id': False if not cutter_head_item['fit_blade_model_code'] else self.env[
'sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_head_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_head_item['fit_blade_model_code'])]).id,
'screw': cutter_head_item['fit_screw_model'],
'spanner': cutter_head_item['fit_wrench_model'],
'is_cooling_hole': cutter_head_item['is_cooling_hole'],
@@ -2757,8 +2735,7 @@ class CuttingToolBasicParameters(models.Model):
val = {
'name': knife_handle_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', knife_handle_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', knife_handle_item['standard_library_code'])]).id,
'taper_shank_model': knife_handle_item['taper_shank_model'],
'total_length': knife_handle_item['total_length'],
'flange_shank_length': knife_handle_item['flange_length'],
@@ -2814,8 +2791,7 @@ class CuttingToolBasicParameters(models.Model):
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
[(
'code', '=',
- integral_tool_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ integral_tool_item['standard_library_code'])]).id,
'total_length': integral_tool_item['total_length'],
'blade_diameter': integral_tool_item['blade_diameter'],
'blade_length': integral_tool_item['blade_length'],
@@ -2841,8 +2817,7 @@ class CuttingToolBasicParameters(models.Model):
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
[(
'code', '=',
- integral_tool_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ integral_tool_item['standard_library_code'])]).id,
'total_length': integral_tool_item['total_length'],
'blade_diameter': integral_tool_item['blade_diameter'],
'blade_length': integral_tool_item['blade_length'],
@@ -2875,8 +2850,7 @@ class CuttingToolBasicParameters(models.Model):
'code': blade_item['code'],
'cutting_tool_type': '刀片',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', blade_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', blade_item['standard_library_code'])]).id,
'length': blade_item['length'],
'thickness': blade_item['thickness'],
'cutting_blade_length': blade_item['cutting_blade_length'],
@@ -2906,8 +2880,7 @@ class CuttingToolBasicParameters(models.Model):
blade.write({
'name': blade_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', blade_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', blade_item['standard_library_code'])]).id,
'length': blade_item['length'],
'thickness': blade_item['thickness'],
'cutting_blade_length': blade_item['cutting_blade_length'],
@@ -2946,8 +2919,7 @@ class CuttingToolBasicParameters(models.Model):
'code': chuck_item['code'],
'cutting_tool_type': '夹头',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', chuck_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', chuck_item['standard_library_code'])]).id,
'er_size_model': chuck_item['size_model'],
'min_clamping_diameter': chuck_item['clamping_diameter_min'],
'max_clamping_diameter': chuck_item['clamping_diameter_max'],
@@ -2966,8 +2938,7 @@ class CuttingToolBasicParameters(models.Model):
chuck.write({
'name': chuck_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', chuck_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', chuck_item['standard_library_code'])]).id,
'er_size_model': chuck_item['size_model'],
'min_clamping_diameter': chuck_item['clamping_diameter_min'],
'max_clamping_diameter': chuck_item['clamping_diameter_max'],
@@ -2996,8 +2967,7 @@ class CuttingToolBasicParameters(models.Model):
'code': cutter_arbor_item['code'],
'cutting_tool_type': '刀杆',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_arbor_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_arbor_item['standard_library_code'])]).id,
'height': cutter_arbor_item['height'],
'width': cutter_arbor_item['width'],
'total_length': cutter_arbor_item['total_length'],
@@ -3015,8 +2985,7 @@ class CuttingToolBasicParameters(models.Model):
'installing_structure': cutter_arbor_item['mounting_structure'],
'blade_id': False if not cutter_arbor_item['fit_blade_model_code'] else self.env[
'sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_arbor_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_arbor_item['fit_blade_model_code'])]).id,
'tool_shim': cutter_arbor_item['fit_knife_pad_model'],
'cotter_pin': cutter_arbor_item['fit_pin_model'],
'pressing_plate': cutter_arbor_item['fit_plate_model'],
@@ -3028,8 +2997,7 @@ class CuttingToolBasicParameters(models.Model):
cutter_arbor.write({
'name': cutter_arbor_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_arbor_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_arbor_item['standard_library_code'])]).id,
'height': cutter_arbor_item['height'],
'width': cutter_arbor_item['width'],
'total_length': cutter_arbor_item['total_length'],
@@ -3049,8 +3017,7 @@ class CuttingToolBasicParameters(models.Model):
self.env[
'sf.cutting_tool.standard.library'].search(
[('code', '=',
- cutter_arbor_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ cutter_arbor_item['fit_blade_model_code'])]).id,
'tool_shim': cutter_arbor_item['fit_knife_pad_model'],
'cotter_pin': cutter_arbor_item['fit_pin_model'],
'pressing_plate': cutter_arbor_item['fit_plate_model'],
@@ -3071,8 +3038,7 @@ class CuttingToolBasicParameters(models.Model):
'code': cutter_head_item['code'],
'cutting_tool_type': '刀盘',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_head_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_head_item['standard_library_code'])]).id,
'install_blade_tip_num': cutter_head_item['number_blade_installed'],
'blade_diameter': cutter_head_item['blade_diameter'],
'cutter_head_diameter': cutter_head_item['cutter_diameter'],
@@ -3085,8 +3051,7 @@ class CuttingToolBasicParameters(models.Model):
'installing_structure': cutter_head_item['mounting_structure'],
'blade_id': False if not cutter_head_item['fit_blade_model_code'] else self.env[
'sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_head_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_head_item['fit_blade_model_code'])]).id,
'screw': cutter_head_item['fit_screw_model'],
'spanner': cutter_head_item['fit_wrench_model'],
'is_cooling_hole': cutter_head_item['is_cooling_hole'],
@@ -3097,8 +3062,7 @@ class CuttingToolBasicParameters(models.Model):
cutter_head.write({
'name': cutter_head_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', cutter_head_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', cutter_head_item['standard_library_code'])]).id,
'install_blade_tip_num': cutter_head_item['number_blade_installed'],
'blade_diameter': cutter_head_item['blade_diameter'],
'cutter_head_diameter': cutter_head_item['cutter_diameter'],
@@ -3112,8 +3076,7 @@ class CuttingToolBasicParameters(models.Model):
'blade_id': False if not cutter_head_item['fit_blade_model_code'] else self.env[
'sf.cutting_tool.standard.library'].search(
[('code', '=',
- cutter_head_item['fit_blade_model_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ cutter_head_item['fit_blade_model_code'])]).id,
'screw': cutter_head_item['fit_screw_model'],
'spanner': cutter_head_item['fit_wrench_model'],
'is_cooling_hole': cutter_head_item['is_cooling_hole'],
@@ -3134,8 +3097,7 @@ class CuttingToolBasicParameters(models.Model):
'code': knife_handle_item['code'],
'cutting_tool_type': '刀柄',
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', knife_handle_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', knife_handle_item['standard_library_code'])]).id,
'total_length': knife_handle_item['total_length'],
'taper_shank_model': knife_handle_item['taper_shank_model'],
'flange_shank_length': knife_handle_item['flange_length'],
@@ -3161,8 +3123,7 @@ class CuttingToolBasicParameters(models.Model):
knife_handle.write({
'name': knife_handle_item['name'],
'standard_library_id': self.env['sf.cutting_tool.standard.library'].search(
- [('code', '=', knife_handle_item['standard_library_code'].replace("JKM", result[
- 'factory_short_name']))]).id,
+ [('code', '=', knife_handle_item['standard_library_code'])]).id,
'total_length': knife_handle_item['total_length'],
'taper_shank_model': knife_handle_item['taper_shank_model'],
'flange_shank_length': knife_handle_item['flange_length'],