修复智能工厂接收业务平台订单接口bug
This commit is contained in:
@@ -4,7 +4,6 @@ from odoo.exceptions import ValidationError
|
||||
|
||||
class ResProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
# sale_order_id = fields.Many2one('sale.order')
|
||||
|
||||
model_long = fields.Float('长[mm]', digits=(16, 3))
|
||||
model_width = fields.Float('宽[mm]', digits=(16, 3))
|
||||
@@ -13,6 +12,7 @@ class ResProductTemplate(models.Model):
|
||||
model_precision = fields.Float('精度要求', digits=(16, 3))
|
||||
materials_id = fields.Many2one('mrs.production.materials', string='材料')
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
|
||||
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_tmpl_id.active = True
|
||||
@@ -23,9 +23,10 @@ class ResProductTemplate(models.Model):
|
||||
'model_height': item['model_height'],
|
||||
'model_volume': item['model_volume'],
|
||||
'list_price': item['price'],
|
||||
'materials_id': self.env['mrs.production.materials'].sudo().search(
|
||||
[('materials_no', '=', item['texture_code'])]).id,
|
||||
'default_code': '%s-%s' % (order_number, i),
|
||||
'barcode': 'cf0bbe2fdad6339d138cdee732750e3e502140c2',
|
||||
# 'barcode': item['barcode'],
|
||||
'barcode': item['barcode'],
|
||||
'active': True
|
||||
}
|
||||
return copy_product_id.sudo().create(vals)
|
||||
|
||||
Reference in New Issue
Block a user