Browse Source

Dec 30 : [UPDT] Bug Fixed 'product_volume'

pull/313/head
AjmalCybro 2 years ago
parent
commit
ba427d8f41
  1. 2
      product_volume/__manifest__.py
  2. 4
      product_volume/doc/RELEASE_NOTES.md
  3. 1
      product_volume/models/__init__.py
  4. 34
      product_volume/models/product_product.py
  5. 4
      product_volume/views/product_template_views.xml

2
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 "

4
product_volume/doc/RELEASE_NOTES.md

@ -1,7 +1,5 @@
## Module <product_volume>
#### 24.11.2023
#### 21.12.2023
#### Version 17.0.1.0.0
#### ADD
- Initial Commit For Product Volume Calculation

1
product_volume/models/__init__.py

@ -19,4 +19,5 @@
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from . import product_product
from . import product_template

34
product_volume/models/product_product.py

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
################################################################################
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))

4
product_volume/views/product_template_views.xml

@ -15,7 +15,7 @@
<label for="weight"/>
<div class="o_row" name="weight" style="width: 40px;">
<field name="weight"/>
<span>kg</span>
<field name="weight_uom_name"/>
</div>
<label for="volume"/>
<div name="volume">
@ -31,7 +31,7 @@
<div class="o_row">
<field name="volume" string="Volume"
style="width: 40px;"/>
<span></span>
<field name="volume_uom_name"/>
</div>
</div>
</group>

Loading…
Cancel
Save