修复sf同步问题
This commit is contained in:
@@ -9,10 +9,8 @@ _logger = logging.getLogger(__name__)
|
||||
class MachineBrandTags(models.Model):
|
||||
_name = 'mrs.machine.brand.tags'
|
||||
_description = '标签'
|
||||
brand_id = fields.Many2one('mrs.machine.brand', '品牌')
|
||||
name = fields.Char('名称', size=50)
|
||||
color = fields.Integer('颜色', default=0)
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
|
||||
class MachineControlSystem(models.Model):
|
||||
@@ -108,7 +106,7 @@ class MachineToolType(models.Model):
|
||||
c_axis = fields.Integer('C轴')
|
||||
remark = fields.Text('备注')
|
||||
precision = fields.Float('加工精度')
|
||||
control_system_id = fields.Many2one('mrs.machine_tool.type.control_system',
|
||||
control_system_id = fields.Many2one('mrs.machine.control_system',
|
||||
string="控制系统")
|
||||
active = fields.Boolean('有效', default=True)
|
||||
code = fields.Char('编码')
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
groups="base.group_system"/>-->
|
||||
<menuitem
|
||||
id="menu_mrs_machine_tool"
|
||||
parent="mrp.menu_mrp_configuration"
|
||||
name="机床注册"
|
||||
parent="menu_mrs_base"
|
||||
name="机床"
|
||||
sequence="0"
|
||||
action="action_mrs_machine_tool"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
sequence="0"
|
||||
sequence="2"
|
||||
name="基础数据"
|
||||
id="menu_mrs_base"
|
||||
action="mrs_production_materials"
|
||||
@@ -34,7 +34,7 @@
|
||||
id="menu_mrs_production_materials_1"
|
||||
name="原材料"
|
||||
parent="mrp.menu_mrp_configuration"
|
||||
sequence="0"
|
||||
sequence="3"
|
||||
|
||||
/>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
id="menu_mrs_production_process_1"
|
||||
name="工艺"
|
||||
parent="mrp.menu_mrp_configuration"
|
||||
sequence="0"
|
||||
sequence="4"
|
||||
|
||||
/>
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
id="menu_mrs_cutting_tool"
|
||||
parent="mrp.menu_mrp_configuration"
|
||||
name="刀具"
|
||||
sequence="0"/>
|
||||
sequence="5"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_mrs_cutting_tool_category"
|
||||
|
||||
@@ -107,7 +107,8 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="brand_id" required="1"
|
||||
domain="[('tag_ids', '=', '机床')]"/>
|
||||
domain="[('tag_ids', '=', '机床')]"
|
||||
options="{'no_create': True}" />
|
||||
</group>
|
||||
</group>
|
||||
<group string="参数">
|
||||
@@ -120,25 +121,25 @@
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('number_of_axles', '=', False)]}">
|
||||
<label for="x_axis" string="x"/>
|
||||
<field name="x_axis" class="o_address_city" required="1"/>
|
||||
<field name="x_axis" class="o_address_city" required="1" options="{'format': false}" />
|
||||
<label for="y_axis" string="y"/>
|
||||
<field name="y_axis" class="o_address_zip" required="1"/>
|
||||
<field name="y_axis" class="o_address_zip" required="1" options="{'format': false}" />
|
||||
<label for="z_axis" string="z"/>
|
||||
<field name="z_axis" class="o_address_zip" required="1"/>
|
||||
<field name="z_axis" class="o_address_zip" required="1" options="{'format': false}" />
|
||||
<label for="b_axis" string="b"
|
||||
attrs="{'invisible': [('number_of_axles', '=', '3轴')]}"/>
|
||||
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"/>
|
||||
<field name="b_axis" class="o_address_city" required="1"
|
||||
attrs="{'invisible': [('number_of_axles', '=', '3轴')]}"/>
|
||||
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}" options="{'format': false}" />
|
||||
<label for="c_axis" string="c"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['3轴','4轴'])]}"/>
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
|
||||
<field name="c_axis" class="o_address_zip" required="1"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['3轴','4轴'])]}"/>
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}" options="{'format': false}" />
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<field name="rotate_speed" string="转速(min)" required="1" options="{'format': false}"/>
|
||||
<field name="precision" required="1" string="加工精度(mm)" />
|
||||
<field name="control_system_id" required="1" />
|
||||
<field name="precision" required="1" string="加工精度(mm)"/>
|
||||
<field name="control_system_id" required="1" options="{'no_create': True}" />
|
||||
</group>
|
||||
</group>
|
||||
<group string="其它">
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import logging
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -38,7 +39,7 @@ class ResConfigSettings(models.TransientModel):
|
||||
_logger.info("同步资源库刀具")
|
||||
# self.env['mrs.processing.order'].sync_all_processing_order()
|
||||
|
||||
return _logger.info("同步资源库成功")
|
||||
|
||||
|
||||
@api.model
|
||||
def get_values(self):
|
||||
|
||||
@@ -39,7 +39,6 @@ class MrsProductionMaterials(models.Model):
|
||||
if brand:
|
||||
brand.id = item['id'],
|
||||
brand.name = item['name'],
|
||||
brand.materials_no = item['materials_no'],
|
||||
brand.remark = item['remark'],
|
||||
brand.active = item['active']
|
||||
else:
|
||||
@@ -68,18 +67,17 @@ class MrsProductionMaterials(models.Model):
|
||||
if result['status'] == 1:
|
||||
for item in result['production_materials_all_list']:
|
||||
if item:
|
||||
# brand = self.env['mrs.production.materials'].search(
|
||||
# [("materials_no", '=', item['materials_no'])])
|
||||
# if brand:
|
||||
# print(item['name'])
|
||||
# else:
|
||||
self.env['mrs.production.materials'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"materials_no": item['materials_no'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active']
|
||||
})
|
||||
|
||||
brand = self.env['mrs.production.materials'].search(
|
||||
[("materials_no", '=', item['materials_no'])])
|
||||
if not brand:
|
||||
self.env['mrs.production.materials'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"materials_no": item['materials_no'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active']
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -112,7 +110,8 @@ class MrsMaterialModel(models.Model):
|
||||
brand.remark = item['remark'],
|
||||
brand.active = item['active'],
|
||||
brand.mf_materia_post = item['mf_materia_post'],
|
||||
brand.materials_id = item['materials_id'],
|
||||
brand.materials_id = self.env['mrs.production.materials'].search(
|
||||
[("materials_no", '=', item['materials_id.materials_no'])]).id,
|
||||
brand.need_h = item['need_h'],
|
||||
brand.density = item['density']
|
||||
else:
|
||||
@@ -122,7 +121,8 @@ class MrsMaterialModel(models.Model):
|
||||
"materials_no": item['materials_no'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
"materials_id": item['materials_id'],
|
||||
"materials_id": self.env['mrs.production.materials'].search(
|
||||
[("materials_no", '=', item['materials_id.materials_no'])]).id,
|
||||
"need_h": item['need_h'],
|
||||
"mf_materia_post": item['mf_materia_post'],
|
||||
"density": item['density'],
|
||||
@@ -145,16 +145,19 @@ class MrsMaterialModel(models.Model):
|
||||
if result['status'] == 1:
|
||||
for item in result['materials_model_all_list']:
|
||||
if item:
|
||||
self.env['mrs.materials.model'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"materials_no": item['materials_no'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
"materials_id": item['materials_id'],
|
||||
"need_h": item['need_h'],
|
||||
"mf_materia_post": item['mf_materia_post'],
|
||||
"density": item['density'],
|
||||
brand = self.env['mrs.materials.model'].search(
|
||||
[("materials_no", '=', item['materials_no'])])
|
||||
if not brand:
|
||||
self.env['mrs.materials.model'].create({
|
||||
"name": item['name'],
|
||||
"materials_no": item['materials_no'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
"materials_id": self.env['mrs.production.materials'].search(
|
||||
[("materials_no", '=', item['materials_id.materials_no'])]).id,
|
||||
"need_h": item['need_h'],
|
||||
"mf_materia_post": item['mf_materia_post'],
|
||||
"density": item['density'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
@@ -217,15 +220,18 @@ class MrsProductionProcess(models.Model):
|
||||
if result['status'] == 1:
|
||||
for item in result['production_process_all_list']:
|
||||
if item:
|
||||
self.env['mrs.production.process'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"process_encode": item['process_encode'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
brand = self.env['mrs.production.process'].search(
|
||||
[("process_encode", '=', item['process_encode'])])
|
||||
if not brand:
|
||||
self.env['mrs.production.process'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"process_encode": item['process_encode'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -284,15 +290,18 @@ class MrsProcessingTechnology(models.Model):
|
||||
if result['status'] == 1:
|
||||
for item in result['processing_technology_all_list']:
|
||||
if item:
|
||||
self.env['mrs.processing.technology'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"process_encode": item['process_encode'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
brand = self.env['mrs.processing.technology'].search(
|
||||
[("process_encode", '=', item['process_encode'])])
|
||||
if not brand:
|
||||
self.env['mrs.processing.technology'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"process_encode": item['process_encode'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -344,12 +353,15 @@ class MachineBrandTags(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['machine_brand_tags_all_list']:
|
||||
self.env['mrs.machine.brand.tags'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"color": item['color'],
|
||||
brand = self.env['mrs.machine.brand.tags'].search(
|
||||
[("name", '=', item['name'])])
|
||||
if not brand:
|
||||
self.env['mrs.machine.brand.tags'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"color": item['color'],
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
@@ -380,6 +392,7 @@ class MachineControlSystem(models.Model):
|
||||
brand.id = item['id'],
|
||||
brand.name = item['name'],
|
||||
brand.code = item['code'],
|
||||
brand.brand_id=self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
brand.active = item['active']
|
||||
else:
|
||||
self.env['mrs.machine.control_system'].create({
|
||||
@@ -387,7 +400,7 @@ class MachineControlSystem(models.Model):
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
|
||||
# "brand_id": item['brand_id'],
|
||||
'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
@@ -410,17 +423,19 @@ class MachineControlSystem(models.Model):
|
||||
if result['status'] == 1:
|
||||
for item in result['machine_control_system_all_list']:
|
||||
if item:
|
||||
self.env['mrs.machine.control_system'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
brand = self.env['mrs.machine.control_system'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['mrs.machine.control_system'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
|
||||
"brand_id": self.env['mrs.machine.brand'].search(
|
||||
[("id", '=', item['brand_id'])]),
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -478,17 +493,20 @@ class MachineBrand(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['machine_brand_all_list']:
|
||||
self.env['mrs.machine.brand'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
# "image_brand": item['image_brand'],
|
||||
"active": item['active'],
|
||||
"tag_ids": self.env['mrs.machine.brand.tags'].search(
|
||||
[("id", 'in', item['tag_ids'])])
|
||||
brand = self.env['mrs.machine.brand'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['mrs.machine.brand'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
# "image_brand": item['image_brand'],
|
||||
"active": item['active'],
|
||||
"tag_ids": self.env['mrs.machine.brand.tags'].search(
|
||||
[("name", 'in', item['tag_ids'])]).ids
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -520,7 +538,7 @@ class MachineTool(models.Model):
|
||||
'number_of_knife_library': item.number_of_knife_library,
|
||||
'rotate_speed': item.rotate_speed,
|
||||
'number_of_axles': item.number_of_axles,
|
||||
'control_system_id': item.control_system_id.id,
|
||||
# 'control_system_id': item.control_system_id.id,
|
||||
# 'type_id': item.type_id.id,
|
||||
# 'brand_id': item.brand_id.id,
|
||||
'factory_id': item.factory_id.id,
|
||||
@@ -569,7 +587,7 @@ class MachineTool(models.Model):
|
||||
brand.number_of_knife_library = item['number_of_knife_library'],
|
||||
brand.rotate_speed = item['rotate_speed'],
|
||||
brand.number_of_axles = item['number_of_axles'],
|
||||
brand.control_system_id = item['control_system_id'],
|
||||
# brand.control_system_id = item['control_system_id'],
|
||||
brand.type_id = item['type_id'],
|
||||
brand.brand_id = item['brand_id'],
|
||||
brand.x_axis = item['x_axis'],
|
||||
@@ -592,7 +610,7 @@ class MachineTool(models.Model):
|
||||
"number_of_knife_library": item['number_of_knife_library'],
|
||||
"rotate_speed": item['rotate_speed'],
|
||||
"number_of_axles": item['number_of_axles'],
|
||||
"control_system_id": item['control_system_id'],
|
||||
# "control_system_id": item['control_system_id'],
|
||||
"type_id": item['type_id'],
|
||||
"brand_id": item['brand_id'],
|
||||
"x_axis": item['x_axis'],
|
||||
@@ -621,30 +639,34 @@ class MachineTool(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['machine_tool_all_list']:
|
||||
self.env['mrs.machine_tool'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"precision": item['precision'],
|
||||
"code": item['code'],
|
||||
"status": item['status'],
|
||||
"knife_type": item['knife_type'],
|
||||
"registration_date": item['registration_date'],
|
||||
"number_of_knife_library": item['number_of_knife_library'],
|
||||
"rotate_speed": item['rotate_speed'],
|
||||
"number_of_axles": item['number_of_axles'],
|
||||
"control_system_id": item['control_system_id'],
|
||||
"type_id": item['type_id'],
|
||||
"brand_id": item['brand_id'],
|
||||
"x_axis": item['x_axis'],
|
||||
"y_axis": item['y_axis'],
|
||||
"z_axis": item['z_axis'],
|
||||
"b_axis": item['b_axis'],
|
||||
"c_axis": item['c_axis'],
|
||||
"state": item['state'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
brand = self.env['mrs.machine_tool'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['mrs.machine_tool'].create({
|
||||
|
||||
})
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"precision": item['precision'],
|
||||
"code": item['code'],
|
||||
"status": item['status'],
|
||||
"knife_type": item['knife_type'],
|
||||
"registration_date": item['registration_date'],
|
||||
"number_of_knife_library": item['number_of_knife_library'],
|
||||
"rotate_speed": item['rotate_speed'],
|
||||
"number_of_axles": item['number_of_axles'],
|
||||
# "control_system_id": item['control_system_id'],
|
||||
"type_id": item['type_id'],
|
||||
'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
"x_axis": item['x_axis'],
|
||||
"y_axis": item['y_axis'],
|
||||
"z_axis": item['z_axis'],
|
||||
"b_axis": item['b_axis'],
|
||||
"c_axis": item['c_axis'],
|
||||
"state": item['state'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -677,8 +699,8 @@ class MachineToolType(models.Model):
|
||||
brand.number_of_knife_library = item['number_of_knife_library'],
|
||||
brand.rotate_speed = item['rotate_speed'],
|
||||
brand.number_of_axles = item['number_of_axles'],
|
||||
brand.control_system_id = item['control_system_id'],
|
||||
brand.brand_id = item['brand_id'],
|
||||
brand.control_system_id = self.env['mrs.machine.control_system'].search([('code', '=', item['control_system_id'])]).id,
|
||||
|
||||
brand.x_axis = item['x_axis'],
|
||||
brand.y_axis = item['y_axis'],
|
||||
brand.z_axis = item['z_axis'],
|
||||
@@ -686,17 +708,18 @@ class MachineToolType(models.Model):
|
||||
brand.c_axis = item['c_axis'],
|
||||
brand.active = item['active'],
|
||||
brand.remark = item['remark'],
|
||||
brand.machine_tool_id = item['machine_tool_id']
|
||||
brand.brand_id=self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
brand.machine_tool_id = self.env['mrs.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id
|
||||
|
||||
else:
|
||||
self.env['mrs.machine_tool.type'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"brand_id": item['brand_id'],
|
||||
|
||||
"number_of_knife_library": item['number_of_knife_library'],
|
||||
"rotate_speed": item['rotate_speed'],
|
||||
"machine_tool_id": item['machine_tool_id'],
|
||||
'machine_tool_id' : self.env['mrs.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id,
|
||||
"number_of_axles": item['number_of_axles'],
|
||||
"x_axis": item['x_axis'],
|
||||
"y_axis": item['y_axis'],
|
||||
@@ -705,8 +728,9 @@ class MachineToolType(models.Model):
|
||||
"c_axis": item['c_axis'],
|
||||
"remark": item['remark'],
|
||||
"precision": item['precision'],
|
||||
"control_system_id": item['control_system_id'],
|
||||
"active": item['active']
|
||||
'control_system_id' : self.env['mrs.machine.control_system'].search([('code', '=', item['control_system_id'])]).id,
|
||||
"active": item['active'],
|
||||
'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
|
||||
})
|
||||
else:
|
||||
@@ -725,26 +749,29 @@ class MachineToolType(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['machine_tool_type_all_list']:
|
||||
self.env['mrs.machine_tool.type'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"brand_id": item['brand_id'],
|
||||
"number_of_knife_library": item['number_of_knife_library'],
|
||||
"rotate_speed": item['rotate_speed'],
|
||||
"machine_tool_id": item['machine_tool_id'],
|
||||
"number_of_axles": item['number_of_axles'],
|
||||
"x_axis": item['x_axis'],
|
||||
"y_axis": item['y_axis'],
|
||||
"z_axis": item['z_axis'],
|
||||
"b_axis": item['b_axis'],
|
||||
"c_axis": item['c_axis'],
|
||||
"remark": item['remark'],
|
||||
"precision": item['precision'],
|
||||
"control_system_id": item['control_system_id'],
|
||||
"active": item['active']
|
||||
brand = self.env['mrs.machine_tool.type'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['mrs.machine_tool.type'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"number_of_knife_library": item['number_of_knife_library'],
|
||||
"rotate_speed": item['rotate_speed'],
|
||||
'machine_tool_id' : self.env['mrs.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id,
|
||||
"number_of_axles": item['number_of_axles'],
|
||||
"x_axis": item['x_axis'],
|
||||
"y_axis": item['y_axis'],
|
||||
"z_axis": item['z_axis'],
|
||||
"b_axis": item['b_axis'],
|
||||
"c_axis": item['c_axis'],
|
||||
"remark": item['remark'],
|
||||
"precision": item['precision'],
|
||||
'control_system_id' : self.env['mrs.machine.control_system'].search([('code', '=', item['control_system_id'])]).id,
|
||||
"active": item['active'],
|
||||
'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
|
||||
})
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -801,15 +828,18 @@ class CuttingTool(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['cutting_tool_category_all_list']:
|
||||
self.env['mrs.cutting_tool.category'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
brand = self.env['mrs.cutting_tool.category'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['mrs.cutting_tool.category'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"code": item['code'],
|
||||
"remark": item['remark'],
|
||||
"active": item['active'],
|
||||
# "tag_ids": item['tag_ids']
|
||||
|
||||
})
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -847,6 +877,8 @@ class CuttingToolType(models.Model):
|
||||
brand.taper_shank_length = item['taper_shank_length'],
|
||||
brand.tool_length = item['tool_length'],
|
||||
brand.blade_number = item['blade_number']
|
||||
brand.brand_id = self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
brand.category_id = self.env['mrs.cutting_tool.category'].search([('code', '=', item['category_id'])]).id
|
||||
else:
|
||||
self.env['mrs.cutting_tool.type'].create({
|
||||
"id": item['id'],
|
||||
@@ -861,8 +893,8 @@ class CuttingToolType(models.Model):
|
||||
"taper_shank_length": item['taper_shank_length'],
|
||||
"tool_length": item['tool_length'],
|
||||
"blade_number": item['blade_number'],
|
||||
# "brand_id": item['brand_id'],
|
||||
# "category_id": item['category_id']
|
||||
'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
"category_id": self.env['mrs.cutting_tool.category'].search([('code', '=', item['category_id'])]).id,
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
@@ -880,22 +912,25 @@ class CuttingToolType(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['cutting_tool_type_all_list']:
|
||||
self.env['mrs.cutting_tool.type'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"remark": item['remark'],
|
||||
"code": item['code'],
|
||||
"active": item['active'],
|
||||
"diameter": item['diameter'],
|
||||
"cone_angle_pitch": item['cone_angle_pitch'],
|
||||
"shank_diameter": item['shank_diameter'],
|
||||
"long_blade": item['long_blade'],
|
||||
"taper_shank_length": item['taper_shank_length'],
|
||||
"tool_length": item['tool_length'],
|
||||
"blade_number": item['blade_number'],
|
||||
# "brand_id": item['brand_id'],
|
||||
# "category_id": item['category_id']
|
||||
})
|
||||
brand = self.env['mrs.cutting_tool.type'].search(
|
||||
[("code", '=', item['code'])])
|
||||
if not brand:
|
||||
self.env['mrs.cutting_tool.type'].create({
|
||||
"id": item['id'],
|
||||
"name": item['name'],
|
||||
"remark": item['remark'],
|
||||
"code": item['code'],
|
||||
"active": item['active'],
|
||||
"diameter": item['diameter'],
|
||||
"cone_angle_pitch": item['cone_angle_pitch'],
|
||||
"shank_diameter": item['shank_diameter'],
|
||||
"long_blade": item['long_blade'],
|
||||
"taper_shank_length": item['taper_shank_length'],
|
||||
"tool_length": item['tool_length'],
|
||||
"blade_number": item['blade_number'],
|
||||
'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id,
|
||||
"category_id": self.env['mrs.cutting_tool.category'].search([('code', '=', item['category_id'])]).id,
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
@@ -946,10 +981,13 @@ class MrsProcessingOrder(models.Model):
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
for item in result['processing_order_all_list']:
|
||||
self.env['mrs.processing.order'].create({
|
||||
"id": item['id'],
|
||||
"sequence": item['sequence'],
|
||||
})
|
||||
brand = self.env['mrs.processing.order'].search(
|
||||
[("id", '=', item['id'])])
|
||||
if not brand:
|
||||
self.env['mrs.processing.order'].create({
|
||||
"id": item['id'],
|
||||
"sequence": item['sequence'],
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" name="sf_all_sync" string="同步资源库所有基础数据"/>
|
||||
<button type="object" class="oe_highlight" name="sf_all_sync" string="同步资源库所有基础数据" />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user