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