diff --git a/ext/custom-addons/dp_custom/models/product.py b/ext/custom-addons/dp_custom/models/product.py index 1f8f4e1b..05ea6a23 100644 --- a/ext/custom-addons/dp_custom/models/product.py +++ b/ext/custom-addons/dp_custom/models/product.py @@ -59,6 +59,13 @@ class ProductTemplate(models.Model): manufacturing_number = fields.Char(string='Herstellnummer') product_color = fields.Char(string='Farbe') + @api.onchange('length', 'width', 'thickness') + def _onchange_measures(self): + if self.length>0 and self.width>0 and self.thickness>0: + self.volume = self.length*self.width*self.thickness/(1000*1000*1000) + elif self.length>0 and self.width>0 and self.height>0: + self.volume = self.length*self.width*self.height/(1000*1000*1000) + @api.model def create_product(self, vals): """ diff --git a/ext/custom-addons/dp_custom/views/account_views.xml b/ext/custom-addons/dp_custom/views/account_views.xml index d1138cec..9eefaea5 100644 --- a/ext/custom-addons/dp_custom/views/account_views.xml +++ b/ext/custom-addons/dp_custom/views/account_views.xml @@ -7,7 +7,7 @@ - + diff --git a/ext/custom-addons/dp_custom/views/sale_views.xml b/ext/custom-addons/dp_custom/views/sale_views.xml index f1915e35..f3a6c259 100644 --- a/ext/custom-addons/dp_custom/views/sale_views.xml +++ b/ext/custom-addons/dp_custom/views/sale_views.xml @@ -51,9 +51,11 @@ + +