diff --git a/sf_dlm/models/product_template.py b/sf_dlm/models/product_template.py index a2d848c2..e4b15922 100644 --- a/sf_dlm/models/product_template.py +++ b/sf_dlm/models/product_template.py @@ -76,9 +76,9 @@ class ResProductTemplate(models.Model): vals = { 'name': '%s-%s-%s' % ('P', order_id.name, i), 'blank_type': item.get('blank_type'), - 'model_long': item['model_long'] + model_type.embryo_tolerance, - 'model_width': item['model_width'] + model_type.embryo_tolerance, - 'model_height': item['model_height'] + model_type.embryo_tolerance, + 'model_long': item.get('blank_length') if item.get('blank_length') else item['model_long'] + model_type.embryo_tolerance, + 'model_width': item.get('blank_width') if item.get('blank_width') else item['model_width'] + model_type.embryo_tolerance, + 'model_height': item.get('blank_height') if item.get('blank_height') else 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), diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index eec6b118..5f371aed 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -897,9 +897,9 @@ class ResProductMo(models.Model): vals = { 'name': product_name, 'blank_type': item.get('blank_type'), - 'model_long': self.format_float(item['model_long'] + embryo_redundancy_id.long), - 'model_width': self.format_float(item['model_width'] + embryo_redundancy_id.width), - 'model_height': self.format_float(item['model_height'] + embryo_redundancy_id.height), + 'model_long': item.get('blank_length') if item.get('blank_length') else self.format_float(item['model_long'] + embryo_redundancy_id.long), + 'model_width': item.get('blank_width') if item.get('blank_width') else self.format_float(item['model_width'] + embryo_redundancy_id.width), + 'model_height': item.get('blank_height') if item.get('blank_height') else self.format_float(item['model_height'] + embryo_redundancy_id.height), 'model_volume': self.format_float((item['model_long'] + embryo_redundancy_id.long) * ( item['model_width'] + embryo_redundancy_id.width) * ( item['model_height'] + embryo_redundancy_id.height)),