新增根据模型类型计算出产品的胚料尺寸
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from odoo import models, fields
|
||||
from odoo import models, fields,api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
@@ -45,6 +45,22 @@ class ResProductTemplate(models.Model):
|
||||
copy_product_id.sudo().write(vals)
|
||||
return copy_product_id
|
||||
|
||||
# 在产品上增加模型类型和加工的面(例如:A、B) ,
|
||||
# 并根据模型类型计算出产品的胚料尺寸;
|
||||
@api.onchange('model_type_id')
|
||||
def count_embryo_size(self):
|
||||
bom = self.env['mrp.bom.line'].search(
|
||||
[('product_tmpl_id', '=', self.id)])
|
||||
for item in self:
|
||||
print(bom.product_tmpl_id)
|
||||
print(bom.model_long)
|
||||
item.model_long = bom.model_long + 1
|
||||
print(item.model_long)
|
||||
item.embryo_width = bom.embryo_width + 1
|
||||
item.embryo_height = bom.embryo_height + 1
|
||||
|
||||
|
||||
|
||||
|
||||
class ResProductCategory(models.Model):
|
||||
_inherit = "product.category"
|
||||
@@ -94,3 +110,7 @@ class ResMrpBom(models.Model):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user