diff --git a/product_volume/__manifest__.py b/product_volume/__manifest__.py index 42d3929a5..04293d8cc 100644 --- a/product_volume/__manifest__.py +++ b/product_volume/__manifest__.py @@ -21,7 +21,7 @@ ################################################################################ { 'name': 'Product Volume Calculation', - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': "Inventory", 'summary': """This module will helps you to give dimensions of the product.""", 'description': "Module helps you to manage the length, breadth and height " diff --git a/product_volume/doc/RELEASE_NOTES.md b/product_volume/doc/RELEASE_NOTES.md index b7cf57113..284b9218f 100644 --- a/product_volume/doc/RELEASE_NOTES.md +++ b/product_volume/doc/RELEASE_NOTES.md @@ -1,7 +1,5 @@ ## Module - -#### 24.11.2023 +#### 21.12.2023 #### Version 17.0.1.0.0 #### ADD - Initial Commit For Product Volume Calculation - diff --git a/product_volume/models/__init__.py b/product_volume/models/__init__.py index fb975a310..c7d10dc3a 100644 --- a/product_volume/models/__init__.py +++ b/product_volume/models/__init__.py @@ -19,4 +19,5 @@ # If not, see . # ################################################################################ +from . import product_product from . import product_template diff --git a/product_volume/models/product_product.py b/product_volume/models/product_product.py new file mode 100644 index 000000000..f99a7c393 --- /dev/null +++ b/product_volume/models/product_product.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import api, models, fields + + +class ProductProduct(models.Model): + """Inheriting product_template to add new fields""" + _inherit = 'product.product' + + @api.onchange('length', 'breadth', 'height') + def _onchange_product_measures(self): + """Onchange function to calculate volume of the product""" + self.volume = (float(self.length if self.length else 0) * + float(self.breadth if self.breadth else 0) * float( + self.height if self.height else 0)) diff --git a/product_volume/views/product_template_views.xml b/product_volume/views/product_template_views.xml index 8f1648c8c..037c86e4e 100644 --- a/product_volume/views/product_template_views.xml +++ b/product_volume/views/product_template_views.xml @@ -15,7 +15,7 @@