新增胚料的模型类型
This commit is contained in:
@@ -22,7 +22,8 @@ class ResProductTemplate(models.Model):
|
|||||||
('0.03', '±0.03mm'),
|
('0.03', '±0.03mm'),
|
||||||
('0.02', '±0.02mm'),
|
('0.02', '±0.02mm'),
|
||||||
('0.01', '±0.01mm')], string='加工精度')
|
('0.01', '±0.01mm')], string='加工精度')
|
||||||
model_type_id = fields.Many2one('sf.model.type', string='模型类型')
|
product_model_type_id = fields.Many2one('sf.model.type', string='产品模型类型')
|
||||||
|
embryo_model_type_id = fields.Many2one('sf.model.type', string='胚料模型类型')
|
||||||
model_processing_panel = fields.Char('模型加工面板')
|
model_processing_panel = fields.Char('模型加工面板')
|
||||||
model_surface_process_id = fields.Many2one('sf.production.process', string='表面工艺')
|
model_surface_process_id = fields.Many2one('sf.production.process', string='表面工艺')
|
||||||
model_process_parameters_id = fields.Many2one('sf.processing.technology', string='工艺参数')
|
model_process_parameters_id = fields.Many2one('sf.processing.technology', string='工艺参数')
|
||||||
@@ -36,6 +37,7 @@ class ResProductTemplate(models.Model):
|
|||||||
single_manufacturing = fields.Boolean(string="单个制造")
|
single_manufacturing = fields.Boolean(string="单个制造")
|
||||||
upload_model_file = fields.Many2many('ir.attachment', 'upload_model_file_attachment_ref', string='上传模型文件')
|
upload_model_file = fields.Many2many('ir.attachment', 'upload_model_file_attachment_ref', string='上传模型文件')
|
||||||
model_code = fields.Char('模型编码')
|
model_code = fields.Char('模型编码')
|
||||||
|
is_bfm = fields.Boolean('业务平台是否自动创建产品', default=False)
|
||||||
|
|
||||||
def _get_volume_uom_id_from_ir_config_parameter(self):
|
def _get_volume_uom_id_from_ir_config_parameter(self):
|
||||||
product_length_in_feet_param = self.env['ir.config_parameter'].sudo().get_param('product.volume_in_cubic_feet')
|
product_length_in_feet_param = self.env['ir.config_parameter'].sudo().get_param('product.volume_in_cubic_feet')
|
||||||
@@ -80,7 +82,7 @@ class ResProductTemplate(models.Model):
|
|||||||
'model_volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
'model_volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
||||||
item['model_width'] + model_type.embryo_tolerance) * (
|
item['model_width'] + model_type.embryo_tolerance) * (
|
||||||
item['model_height'] + model_type.embryo_tolerance),
|
item['model_height'] + model_type.embryo_tolerance),
|
||||||
'model_type_id': model_type.id,
|
'product_model_type_id': model_type.id,
|
||||||
'model_processing_panel': 'R',
|
'model_processing_panel': 'R',
|
||||||
'model_machining_precision': item['model_machining_precision'],
|
'model_machining_precision': item['model_machining_precision'],
|
||||||
'model_code': item['barcode'],
|
'model_code': item['barcode'],
|
||||||
@@ -146,7 +148,7 @@ class ResProductTemplate(models.Model):
|
|||||||
'volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
'volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
||||||
item['model_width'] + model_type.embryo_tolerance) * (
|
item['model_width'] + model_type.embryo_tolerance) * (
|
||||||
item['model_height'] + model_type.embryo_tolerance),
|
item['model_height'] + model_type.embryo_tolerance),
|
||||||
# 'model_price': item['price'],
|
'embryo_model_type_id': model_type.id,
|
||||||
'list_price': item['price'],
|
'list_price': item['price'],
|
||||||
'materials_id': materials_id.id,
|
'materials_id': materials_id.id,
|
||||||
'materials_type_id': materials_type_id.id,
|
'materials_type_id': materials_type_id.id,
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
<!-- </field>-->
|
<!-- </field>-->
|
||||||
|
|
||||||
<field name="invoice_policy" position="after">
|
<field name="invoice_policy" position="after">
|
||||||
<field name="model_file" widget="model_viewer"/>
|
<!-- <field name="model_file" widget="model_viewer" attrs="{'invisible': [('categ_id', 'child_of', '成品')]}"/>-->
|
||||||
|
<field name="embryo_model_type_id"/>
|
||||||
<field name="materials_id" string="材料"/>
|
<field name="materials_id" string="材料"/>
|
||||||
<field name="materials_type_id" string="型号"
|
<field name="materials_type_id" string="型号"
|
||||||
domain="[('materials_id', '=', materials_id)]"/>
|
domain="[('materials_id', '=', materials_id)]"/>
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
<!-- <field name="model_width" string="宽[mm]"/>-->
|
<!-- <field name="model_width" string="宽[mm]"/>-->
|
||||||
<!-- <field name="model_height" string="高[mm]"/>-->
|
<!-- <field name="model_height" string="高[mm]"/>-->
|
||||||
<field name="model_volume" string="体积[mm³]"/>
|
<field name="model_volume" string="体积[mm³]"/>
|
||||||
<field name="model_type_id" string="模型类型"/>
|
<field name="product_model_type_id" string="模型类型"/>
|
||||||
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"/>
|
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"/>
|
||||||
<field name="model_machining_precision"/>
|
<field name="model_machining_precision"/>
|
||||||
<field name="model_surface_process_id" string="表面工艺"/>
|
<field name="model_surface_process_id" string="表面工艺"/>
|
||||||
@@ -132,6 +133,9 @@
|
|||||||
<field name="inherit_id" ref="mrp.mrp_product_template_search_view"/>
|
<field name="inherit_id" ref="mrp.mrp_product_template_search_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//filter[@name='consumable']" position="after">
|
<xpath expr="//filter[@name='consumable']" position="after">
|
||||||
|
<!-- <separator/>-->
|
||||||
|
<!-- <filter name="categ_idss" string="产品类别"-->
|
||||||
|
<!-- domain="[('categ_id.type', 'in', ['成品', '胚料','原材料'])]"/>-->
|
||||||
<filter string="胚料" name="embryo" domain="[('categ_id.type', '=', '胚料')]"/>
|
<filter string="胚料" name="embryo" domain="[('categ_id.type', '=', '胚料')]"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class MrpProduction(models.Model):
|
|||||||
processing_panel_len = len(production.product_id.model_processing_panel.split(','))
|
processing_panel_len = len(production.product_id.model_processing_panel.split(','))
|
||||||
for k in (production.product_id.model_processing_panel.split(',')):
|
for k in (production.product_id.model_processing_panel.split(',')):
|
||||||
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
||||||
[('model_type_id', '=', production.product_id.model_type_id.id)],
|
[('product_model_type_id', '=', production.product_id.product_model_type_id.id)],
|
||||||
order='sequence asc'
|
order='sequence asc'
|
||||||
)
|
)
|
||||||
i += 1
|
i += 1
|
||||||
@@ -125,7 +125,7 @@ class MrpProduction(models.Model):
|
|||||||
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||||
elif production.product_id.categ_id.type == '胚料':
|
elif production.product_id.categ_id.type == '胚料':
|
||||||
embryo_routing_workcenter = self.env['sf.embryo.model.type.routing.sort'].search(
|
embryo_routing_workcenter = self.env['sf.embryo.model.type.routing.sort'].search(
|
||||||
[('model_type_id', '=', production.product_id.model_type_id.id)],
|
[('embryo_model_type_id', '=', production.product_id.embryo_model_type_id.id)],
|
||||||
order='sequence asc'
|
order='sequence asc'
|
||||||
)
|
)
|
||||||
for route in embryo_routing_workcenter:
|
for route in embryo_routing_workcenter:
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'),
|
('解除装夹', '解除装夹'),
|
||||||
|
('切割', '切割')
|
||||||
], string="工序类型")
|
], string="工序类型")
|
||||||
|
|
||||||
@api.onchange('users_ids')
|
@api.onchange('users_ids')
|
||||||
@@ -89,7 +90,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工")
|
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工")
|
||||||
tray_code = fields.Char(string="托盘")
|
tray_code = fields.Char(string="托盘")
|
||||||
|
|
||||||
|
|
||||||
# 计算配料中心点和与x轴倾斜度方法
|
# 计算配料中心点和与x轴倾斜度方法
|
||||||
def getcenter(self):
|
def getcenter(self):
|
||||||
try:
|
try:
|
||||||
@@ -135,7 +135,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
except:
|
except:
|
||||||
raise UserError("参数计算有误")
|
raise UserError("参数计算有误")
|
||||||
|
|
||||||
|
|
||||||
def json_workorder_str(self, k, production, route):
|
def json_workorder_str(self, k, production, route):
|
||||||
workorders_values_str = [0, '', {
|
workorders_values_str = [0, '', {
|
||||||
'product_uom_id': production.product_uom_id.id,
|
'product_uom_id': production.product_uom_id.id,
|
||||||
@@ -171,7 +170,9 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
'target': 'new',
|
'target': 'new',
|
||||||
'domain': [('workorder_id', '=', self.id)]
|
'domain': [('workorder_id', '=', self.id)]
|
||||||
}
|
}
|
||||||
|
|
||||||
tray_id = fields.Many2one('sf.tray', string="托盘信息")
|
tray_id = fields.Many2one('sf.tray', string="托盘信息")
|
||||||
|
|
||||||
# 扫码绑定托盘方法
|
# 扫码绑定托盘方法
|
||||||
|
|
||||||
def gettray(self):
|
def gettray(self):
|
||||||
@@ -230,7 +231,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
tray.unclamp()
|
tray.unclamp()
|
||||||
self.tray_id = tray
|
self.tray_id = tray
|
||||||
|
|
||||||
|
|
||||||
# return {
|
# return {
|
||||||
# 'name': _('New Maintenance Request'),
|
# 'name': _('New Maintenance Request'),
|
||||||
# 'view_mode': 'form',
|
# 'view_mode': 'form',
|
||||||
@@ -288,7 +288,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# cnc程序获取
|
# cnc程序获取
|
||||||
def fetchCNC(self):
|
def fetchCNC(self):
|
||||||
try:
|
try:
|
||||||
@@ -499,7 +498,6 @@ class CNCprocessing(models.Model):
|
|||||||
download_state = ftp.download_file_tree(remotepath, serverdir)
|
download_state = ftp.download_file_tree(remotepath, serverdir)
|
||||||
return download_state
|
return download_state
|
||||||
|
|
||||||
|
|
||||||
# 将nc文件存到attach的datas里
|
# 将nc文件存到attach的datas里
|
||||||
def write_file(self, nc_file_path, cnc):
|
def write_file(self, nc_file_path, cnc):
|
||||||
if os.path.exists(nc_file_path):
|
if os.path.exists(nc_file_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user