胚料bug修复,销售订单明细行路线修复,编程单下发优化

This commit is contained in:
jinling.yang
2022-12-27 17:28:47 +08:00
parent c6b9953e40
commit 5fcb17d048
13 changed files with 158 additions and 112 deletions

View File

@@ -77,6 +77,7 @@ class MachineTool(models.Model):
b_axis = fields.Integer('B轴') b_axis = fields.Integer('B轴')
c_axis = fields.Integer('C轴') c_axis = fields.Integer('C轴')
remark = fields.Text('备注') remark = fields.Text('备注')
is_binding = fields.Boolean('是否绑定机床', default=False)
precision = fields.Float('加工精度') precision = fields.Float('加工精度')
control_system_id = fields.Many2one('sf.machine.control_system', control_system_id = fields.Many2one('sf.machine.control_system',
string="控制系统") string="控制系统")

View File

@@ -35,66 +35,72 @@ class Sf_Bf_Connect(http.Controller):
ret['delivery_end_date'], user_id) ret['delivery_end_date'], user_id)
i = 1 i = 1
for item in ret['bfm_process_order_list']: for item in ret['bfm_process_order_list']:
product = request.env['product.template'].sudo().product_create(product_id, item, order_id, product_has = request.env['product.template'].with_user(request.env.ref("base.user_admin")).search([('barcode','=', item['barcode'])])
ret['order_number'], i) if product_has:
# order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item) logging.info('product_has:%s' % product_has)
logging.info('order_id:%s' % order_id) logging.info('barcode:%s' % item['barcode'])
logging.info('product:%s' % product) order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product_has, item)
bom_data = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).get_bom(product)
logging.info('bom_data:%s' % bom_data)
if bom_data:
bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(product,
'normal',
False)
bom.with_user(request.env.ref("base.user_admin")).bom_create_line_has(bom_data)
else: else:
if product.materials_type_id.gain_way == '自加工': product = request.env['product.template'].sudo().product_create(product_id, item, order_id,
# 创建胚料 ret['order_number'], i)
self_machining_embryo = request.env['product.template'].sudo().no_bom_product_create( # order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
self_machining_id, logging.info('order_id:%s' % order_id)
item, logging.info('product:%s' % product)
order_id, 'self_machining') bom_data = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).get_bom(product)
# 创建胚料的bom logging.info('bom_data:%s' % bom_data)
self_machining_bom = request.env['mrp.bom'].with_user( if bom_data:
request.env.ref("base.user_admin")).bom_create( bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(product,
self_machining_embryo, 'normal') 'normal',
# 创建胚料里bom的组件 False)
self_machining_bom.with_user(request.env.ref("base.user_admin")).bom_create_line( bom.with_user(request.env.ref("base.user_admin")).bom_create_line_has(bom_data)
self_machining_embryo) else:
# 产品配置bom if product.materials_type_id.gain_way == '自加工':
product_bom_self_machining = request.env['mrp.bom'].with_user( # 创建胚料
request.env.ref("base.user_admin")).bom_create( self_machining_embryo = request.env['product.template'].sudo().no_bom_product_create(
product, 'normal', False) self_machining_id,
product_bom_self_machining.with_user(request.env.ref("base.user_admin")).bom_create_line_has( item,
self_machining_embryo) order_id, 'self_machining')
elif product.materials_type_id.gain_way == '外协': # 创建胚料的bom
# 创建胚料 self_machining_bom = request.env['mrp.bom'].with_user(
outsource_embryo = request.env['product.template'].sudo().no_bom_product_create(outsource_id, request.env.ref("base.user_admin")).bom_create(
item, self_machining_embryo, 'normal', False)
order_id, # 创建胚料里bom的组件
'subcontract') self_machining_bom.with_user(request.env.ref("base.user_admin")).bom_create_line(
# 创建胚料的bom self_machining_embryo)
outsource_bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create( # 产品配置bom
outsource_embryo, product_bom_self_machining = request.env['mrp.bom'].with_user(
'subcontract', True) request.env.ref("base.user_admin")).bom_create(
# 创建胚料的bom的组件 product, 'normal', False)
outsource_bom.with_user(request.env.ref("base.user_admin")).bom_create_line(outsource_embryo) product_bom_self_machining.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
# 产品配置bom self_machining_embryo)
product_bom_outsource = request.env['mrp.bom'].with_user( elif product.materials_type_id.gain_way == '外协':
request.env.ref("base.user_admin")).bom_create(product, 'normal', False) # 创建胚料
product_bom_outsource.with_user(request.env.ref("base.user_admin")).bom_create_line_has( outsource_embryo = request.env['product.template'].sudo().no_bom_product_create(outsource_id,
outsource_embryo) item,
elif product.materials_type_id.gain_way == '采购': order_id,
purchase_embryo = request.env['product.template'].sudo().no_bom_product_create(purchase_id, 'subcontract')
item, # 创建胚料的bom
order_id, outsource_bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(
'purchase') outsource_embryo,
# 产品配置bom 'subcontract', True)
product_bom_purchase = request.env['mrp.bom'].with_user( # 创建胚料的bom的组件
request.env.ref("base.user_admin")).bom_create(product, 'normal', False) outsource_bom.with_user(request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has( # 产品配置bom
purchase_embryo) product_bom_outsource = request.env['mrp.bom'].with_user(
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item) request.env.ref("base.user_admin")).bom_create(product, 'normal', False)
product_bom_outsource.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
outsource_embryo)
elif product.materials_type_id.gain_way == '采购':
purchase_embryo = request.env['product.template'].sudo().no_bom_product_create(purchase_id,
item,
order_id,
'purchase')
# 产品配置bom
product_bom_purchase = request.env['mrp.bom'].with_user(
request.env.ref("base.user_admin")).bom_create(product, 'normal', False)
product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
purchase_embryo)
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
i += 1 i += 1
res['factory_order_no'] = order_id.name res['factory_order_no'] = order_id.name
return json.JSONEncoder().encode(res) return json.JSONEncoder().encode(res)

View File

@@ -15,7 +15,7 @@
<field name="type">原材料</field> <field name="type">原材料</field>
</record> </record>
<record id="product_template_sf" model="product.template"> <record id="product_template_sf" model="product.product">
<field name="name">CNC加工产品模板</field> <field name="name">CNC加工产品模板</field>
<field name="active" eval="False"/> <field name="active" eval="False"/>
<field name="categ_id" ref="product_category_finished_sf"/> <field name="categ_id" ref="product_category_finished_sf"/>
@@ -31,7 +31,7 @@
<field name="tracking">serial</field> <field name="tracking">serial</field>
</record> </record>
<record id="product_embryo_sf_self_machining" model="product.template"> <record id="product_embryo_sf_self_machining" model="product.product">
<field name="name">胚料自加工模板</field> <field name="name">胚料自加工模板</field>
<field name="active" eval="False"/> <field name="active" eval="False"/>
<field name="categ_id" ref="product_category_embryo_sf"/> <field name="categ_id" ref="product_category_embryo_sf"/>
@@ -48,7 +48,7 @@
<!-- <field name="active" eval="False"/>--> <!-- <field name="active" eval="False"/>-->
</record> </record>
<record id="product_embryo_sf_outsource" model="product.template"> <record id="product_embryo_sf_outsource" model="product.product">
<field name="name">胚料外协加工模板</field> <field name="name">胚料外协加工模板</field>
<field name="active" eval="False"/> <field name="active" eval="False"/>
<field name="categ_id" ref="product_category_embryo_sf"/> <field name="categ_id" ref="product_category_embryo_sf"/>
@@ -63,7 +63,7 @@
<field name="tracking">serial</field> <field name="tracking">serial</field>
<!-- <field name="active" eval="False"/>--> <!-- <field name="active" eval="False"/>-->
</record> </record>
<record id="product_embryo_sf_purchase" model="product.template"> <record id="product_embryo_sf_purchase" model="product.product">
<field name="name">胚料采购模板</field> <field name="name">胚料采购模板</field>
<field name="active" eval="False"/> <field name="active" eval="False"/>
<field name="categ_id" ref="product_category_embryo_sf"/> <field name="categ_id" ref="product_category_embryo_sf"/>

View File

@@ -29,6 +29,7 @@ class ResProductTemplate(models.Model):
materials_id = fields.Many2one('sf.production.materials', string='材料') materials_id = fields.Many2one('sf.production.materials', string='材料')
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号') materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
single_manufacturing = fields.Boolean(string="单个制造") single_manufacturing = fields.Boolean(string="单个制造")
model_id = fields.Many2one('ir.attachment', string='模型')
# 胚料的库存路线设置 # 胚料的库存路线设置
# def _get_routes(self, route_type): # def _get_routes(self, route_type):
@@ -53,19 +54,24 @@ class ResProductTemplate(models.Model):
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品 # 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
def product_create(self, product_id, item, order_id, order_number, i): def product_create(self, product_id, item, order_id, order_number, i):
copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy() copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
# copy_product_id.product_tmpl_id.active = True copy_product_id.product_tmpl_id.active = True
model_type = self.env['sf.model.type'].search([], limit=1)
vals = { vals = {
'name': '%s-%s' % (order_id.name, i), 'name': '%s-%s' % (order_id.name, i),
'model_long': item['model_long'], 'model_long': item['model_long'] + model_type.embryo_tolerance,
'model_width': item['model_width'], 'model_width': item['model_width'] + model_type.embryo_tolerance,
'model_height': item['model_height'], 'model_height': item['model_height'] + model_type.embryo_tolerance,
'model_volume': (item['model_long'] + model_type.embryo_tolerance) * (
item['model_width'] + model_type.embryo_tolerance) * (
item['model_height'] + model_type.embryo_tolerance),
'model_type_id': 1, 'model_type_id': 1,
'model_machining_precision': item['model_machining_precision'], # 'model_machining_precision': item['model_machining_precision'],
'model_processing_panel': 'R,U', 'model_processing_panel': 'A',
'model_machining_precision': '±0.10mm',
'length': item['model_long'], 'length': item['model_long'],
'width': item['model_width'], 'width': item['model_width'],
'height': item['model_height'], 'height': item['model_height'],
'volume': (item['model_long'] * item['model_width'] * item['model_height']), 'volume': item['model_long'] * item['model_width'] * item['model_height'],
# 'model_price': item['price'], # 'model_price': item['price'],
# 'single_manufacturing': True, # 'single_manufacturing': True,
'list_price': item['price'], 'list_price': item['price'],
@@ -74,8 +80,8 @@ class ResProductTemplate(models.Model):
[('materials_no', '=', item['texture_code'])]).id, [('materials_no', '=', item['texture_code'])]).id,
'materials_type_id': self.env['sf.materials.model'].search( 'materials_type_id': self.env['sf.materials.model'].search(
[('materials_no', '=', item['texture_type_code'])]).id, [('materials_no', '=', item['texture_type_code'])]).id,
# 'model_surface_process_id': self.env['sf.production.process'].search( 'model_surface_process_id': self.env['sf.production.process'].search(
# [('process_encode', '=', item['surface_process_code'])]).id, [('process_encode', '=', item['surface_process_code'])]).id,
# 'model_process_parameters_id': self.env['sf.processing.technology'].search( # 'model_process_parameters_id': self.env['sf.processing.technology'].search(
# [('process_encode', '=', item['process_parameters_code'])]).id, # [('process_encode', '=', item['process_parameters_code'])]).id,
'model_remark': item['remark'], 'model_remark': item['remark'],
@@ -85,27 +91,40 @@ class ResProductTemplate(models.Model):
# 'route_ids': self._get_routes('') # 'route_ids': self._get_routes('')
} }
copy_product_id.sudo().write(vals) copy_product_id.sudo().write(vals)
# product_id.active = False copy_product_id.model_id = self.attachment_create(item['model_name'], item['model_data'])
product_id.product_tmpl_id.active = False
return copy_product_id return copy_product_id
def attachment_create(self, name, data):
attachment = self.env['ir.attachment'].create({
'datas': base64.b64encode(data),
'type': 'binary',
'description': '模型文件',
'name': name
})
return attachment
# 创建胚料 # 创建胚料
def no_bom_product_create(self, product_id, item, order_id, route_type): def no_bom_product_create(self, product_id, item, order_id, route_type):
no_bom_copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy() no_bom_copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
# no_bom_copy_product_id.product_tmpl_id.active = True no_bom_copy_product_id.product_tmpl_id.active = True
materials_id = self.env['sf.production.materials'].search( materials_id = self.env['sf.production.materials'].search(
[('materials_no', '=', item['texture_code'])]) [('materials_no', '=', item['texture_code'])])
materials_type_id = self.env['sf.materials.model'].search( materials_type_id = self.env['sf.materials.model'].search(
[('materials_no', '=', item['texture_type_code'])]) [('materials_no', '=', item['texture_type_code'])])
model_type = self.env['sf.model.type'].search([], limit=1)
supplier = self.env['mrp.bom'].get_supplier(materials_type_id) supplier = self.env['mrp.bom'].get_supplier(materials_type_id)
logging.info('no_bom_copy_product_supplier-vals:%s' % supplier) logging.info('no_bom_copy_product_supplier-vals:%s' % supplier)
vals = { vals = {
'name': '%s %s %s %s * %s * %s' % ( 'name': '%s %s %s %s * %s * %s' % (
order_id.name, materials_id.name, materials_type_id.name, item['model_long'], item['model_width'], order_id.name, materials_id.name, materials_type_id.name, item['model_long'], item['model_width'],
item['model_height']), item['model_height']),
'length': item['model_long'], 'length': item['model_long'] + model_type.embryo_tolerance,
'width': item['model_width'], 'width': item['model_width'] + model_type.embryo_tolerance,
'height': item['model_height'], 'height': item['model_height'] + model_type.embryo_tolerance,
'volume': item['model_long'] * item['model_width'] * item['model_height'], 'volume': (item['model_long'] + model_type.embryo_tolerance) * (
item['model_width'] + model_type.embryo_tolerance) * (
item['model_height'] + model_type.embryo_tolerance),
# 'model_price': item['price'], # 'model_price': item['price'],
'list_price': item['price'], 'list_price': item['price'],
'materials_id': materials_id.id, 'materials_id': materials_id.id,
@@ -131,7 +150,7 @@ class ResProductTemplate(models.Model):
logging.info('no_bom_copy_product_id-seller_ids-vals:%s' % no_bom_copy_product_id.seller_ids) logging.info('no_bom_copy_product_id-seller_ids-vals:%s' % no_bom_copy_product_id.seller_ids)
no_bom_copy_product_id.write(vals) no_bom_copy_product_id.write(vals)
logging.info('no_bom_copy_product_id-vals:%s' % vals) logging.info('no_bom_copy_product_id-vals:%s' % vals)
# product_id.active = False product_id.product_tmpl_id.active = False
return no_bom_copy_product_id return no_bom_copy_product_id
# 根据模型类型默认给模型的长高宽加配置的长度; # 根据模型类型默认给模型的长高宽加配置的长度;
@@ -140,11 +159,11 @@ class ResProductTemplate(models.Model):
if not self.model_type_id: if not self.model_type_id:
return return
model_type = self.env['sf.model.type'].search( model_type = self.env['sf.model.type'].search(
[('id', '=', self.model_type_id.id), ('embryo_tolerance', '=', True)]) [('id', '=', self.model_type_id.id)])
if model_type: if model_type:
self.model_long = self.model_long + 1 self.model_long = self.model_long + embryo_tolerance
self.model_width = self.model_width + 1 self.model_width = self.model_width + embryo_tolerance
self.model_height = self.model_width + 1 self.model_height = self.model_width + embryo_tolerance
else: else:
return return

View File

@@ -101,8 +101,8 @@
<field name="inherit_id" ref="mrp.mrp_bom_form_view"/> <field name="inherit_id" ref="mrp.mrp_bom_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="subcontractor_ids" position="replace"> <field name="subcontractor_ids" position="replace">
<field name="subcontractor_id" widget="many2one_tags" readonly="1" <field name="subcontractor_id"
attrs="{'invisible':[('type', 'in', ['normal','phantom'])]}"/> attrs="{'invisible': [('type', '!=', 'subcontract')], 'required': [('type', '=', 'subcontract')]}"/>
</field> </field>
</field> </field>
</record> </record>

View File

@@ -6,7 +6,7 @@ class ModelType(models.Model):
_description = '模型类型' _description = '模型类型'
name = fields.Char('名称') name = fields.Char('名称')
embryo_tolerance = fields.Boolean('胚料的容余量', default=False) embryo_tolerance = fields.Integer('胚料的容余量')
routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板') routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板')

View File

@@ -7,6 +7,12 @@ class ResWorkcenter(models.Model):
_inherit = "mrp.workcenter" _inherit = "mrp.workcenter"
machine_tool_id = fields.Many2one('sf.machine_tool', '机床') machine_tool_id = fields.Many2one('sf.machine_tool', '机床')
@api.onchange('machine_tool_id')
def get_machine_tool_is_binding(self):
print('1111111')
for item in self:
item.machine_tool_id.is_binding = False
equipment_ids = fields.One2many( equipment_ids = fields.One2many(
'maintenance.equipment', 'workcenter_id', string="Maintenance Equipment", 'maintenance.equipment', 'workcenter_id', string="Maintenance Equipment",
check_company=True) check_company=True)

View File

@@ -341,13 +341,13 @@ class CNCprocessing(models.Model):
depth_of_processing_z = fields.Char('加工深度(Z)') depth_of_processing_z = fields.Char('加工深度(Z)')
cutting_tool_extension_length = fields.Char('刀具伸出长度') cutting_tool_extension_length = fields.Char('刀具伸出长度')
cutting_tool_handle_type = fields.Char('刀柄型号') cutting_tool_handle_type = fields.Char('刀柄型号')
estimated_processing_time = fields.Datetime('预计加工时间') estimated_processing_time = fields.Char('预计加工时间')
remark = fields.Text('备注') remark = fields.Text('备注')
workorder_id = fields.Many2one('mrp.workorder', string="工单") workorder_id = fields.Many2one('mrp.workorder', string="工单")
# mrs下发编程单创建CNC加工 # mrs下发编程单创建CNC加工
def cnc_processing_create(self, obj): def cnc_processing_create(self, obj):
workorder = self.env['mrp.workorder'].search([('production_id.name', '=', obj['manufacturing_order_no']), workorder = self.env['mrp.workorder'].search([('production_id.name', '=', obj['production_order_no']),
('processing_panel', '=', obj['processing_panel']), ('processing_panel', '=', obj['processing_panel']),
('routing_type', '=', 'CNC加工')]) ('routing_type', '=', 'CNC加工')])
vals = { vals = {

View File

@@ -31,7 +31,7 @@
<form string="模型类型"> <form string="模型类型">
<group> <group>
<field name="name" required="1"/> <field name="name" required="1"/>
<field name="embryo_tolerance" required="1"/> <field name="embryo_tolerance" string="胚料容余(mm)"/>
</group> </group>
<group> <group>
<field name='routing_tmpl_ids'> <field name='routing_tmpl_ids'>

View File

@@ -81,7 +81,7 @@
</xpath> </xpath>
<xpath expr="//field[@name='alternative_workcenter_ids']" position="after"> <xpath expr="//field[@name='alternative_workcenter_ids']" position="after">
<field name="machine_tool_id"/> <field name="machine_tool_id" domain="[('is_binding', '=', False)]"/>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

@@ -32,20 +32,32 @@ class Sf_Mrs_Connect(http.Controller):
logging.info('model_code:%s' % model_code) logging.info('model_code:%s' % model_code)
server_dir = cnc.with_user(request.env.ref("base.user_admin")).download_file_tmp(model_code, server_dir = cnc.with_user(request.env.ref("base.user_admin")).download_file_tmp(model_code,
processing_panel) processing_panel)
cnc_file_path = os.path.join('/', server_dir, cnc.program_name + '.nc') # cnc_file_path = os.path.join('/', server_dir, cnc.program_name + '.nc')
logging.info('cnc_file_path:%s' % cnc_file_path) # logging.info('cnc_file_path:%s' % cnc_file_path)
cnc.with_user(request.env.ref("base.user_admin")).write_file(cnc_file_path, cnc) # cnc.with_user(request.env.ref("base.user_admin")).write_file(cnc_file_path, cnc)
logging.info('get_cnc_processing_create:%s' % '111111111111111') logging.info('server_dir:%s' % server_dir)
# for root, dirs, files in os.walk(server_dir): for root, dirs, files in os.walk(server_dir):
# for f in files: for f in files:
# if os.path.splitext(f)[1] == ".pdf": logging.info('f:%s' % f)
# pdf_path = os.path.splitext(file)[1] + '.PDF' logging.info('f[0]:%s' % f.split('.')[0])
# if os.path.splitext(f)[1] == ".pdf":
# if pdf_path != False: full_path = os.path.join(server_dir, root, f)
# if not cnc.workorder_id.cnc_worksheet: logging.info('pdf:%s' % full_path)
# cnc.workorder_id.cnc_worksheet = base64.b64encode(open(cnc_pdf_path, 'rb').read()) if full_path != False:
# else: if not cnc.workorder_id.cnc_worksheet:
# logging.info('break:%s' % 'break') cnc.workorder_id.cnc_worksheet = base64.b64encode(open(full_path, 'rb').read())
# break else:
logging.info('break:%s' % 'break')
continue
else:
logging.info('cnc.program_name:%s' % cnc.program_name)
if cnc.program_name == f.split('.')[0]:
logging.info('f[0]:%s' % f[0])
cnc_file_path = os.path.join(server_dir, root, f)
logging.info('cnc_file_path:%s' % cnc_file_path)
cnc.with_user(request.env.ref("base.user_admin")).write_file(cnc_file_path, cnc)
else:
continue
except Exception as e: except Exception as e:
logging.info('get_cnc_processing_create error:%s' % e) logging.info('get_cnc_processing_create error:%s' % e)

View File

@@ -25,15 +25,16 @@ class FtpController():
# 下载目录下的文件 # 下载目录下的文件
def download_file_tree(self, target_dir, serverdir): def download_file_tree(self, target_dir, serverdir):
self.ftp.cwd(target_dir) # 切换工作路径
if not os.path.exists(serverdir): if not os.path.exists(serverdir):
os.makedirs(serverdir) os.makedirs(serverdir)
remotenames = self.ftp.nlst() self.ftp.cwd(target_dir) # 切换工作路径
for file in remotenames: remotenames = self.ftp.nlst()
server = os.path.join(serverdir, file) for file in remotenames:
if file.find(".") != -1: server = os.path.join(serverdir, file)
self.download_file(server, file) if file.find(".") != -1:
return self.download_file(server, file)
else:
return
# 下载指定目录下的指定文件 # 下载指定目录下的指定文件
def download_file(self, serverfile, remotefile): def download_file(self, serverfile, remotefile):

View File

@@ -44,6 +44,7 @@ class ReSaleOrder(models.Model):
product.model_machining_precision, product.model_machining_precision,
product.materials_id.name), product.materials_id.name),
'price_unit': product.list_price, 'price_unit': product.list_price,
'route_ids': product.route_ids,
'product_uom_qty': item['number'] 'product_uom_qty': item['number']
} }
return self.env['sale.order.line'].create(vals) return self.env['sale.order.line'].create(vals)