修复模板类型工序

This commit is contained in:
jinling.yang
2022-11-01 17:30:25 +08:00
parent 7067b29735
commit ae85009a18
9 changed files with 83 additions and 70 deletions

View File

@@ -49,15 +49,16 @@ class ResProductTemplate(models.Model):
# 并根据模型类型计算出产品的胚料尺寸;
@api.onchange('model_type_id')
def count_embryo_size(self):
bom = self.env['mrp.bom.line'].search(
[('product_tmpl_id', '=', self.id)])
bom = self.env['product.product'].search(
[('categ_id.is_embryo', '=', True), ('product_tmpl_id', '=', self.id)],
limit=1,
order='volume desc'
)
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.model_long = bom.embryo_long + 1
item.embryo_width = bom.embryo_width + 1
item.embryo_height = bom.embryo_height + 1
item.volume = item.model_long * item.embryo_width * item.embryo_height