Browse Source

Jan 8 [UPDT] : Updated 'product_volume'

pull/313/head
AjmalCybro 1 year ago
parent
commit
6b1d766722
  1. 2
      product_volume/__manifest__.py
  2. 8
      product_volume/doc/RELEASE_NOTES.md
  3. 1
      product_volume/models/__init__.py
  4. 34
      product_volume/models/product_product.py
  5. 41
      product_volume/models/product_template.py
  6. BIN
      product_volume/static/description/assets/screenshots/1.png
  7. BIN
      product_volume/static/description/assets/screenshots/2.png
  8. BIN
      product_volume/static/description/assets/screenshots/3.png
  9. BIN
      product_volume/static/description/assets/screenshots/4.png
  10. BIN
      product_volume/static/description/assets/screenshots/hero.gif
  11. BIN
      product_volume/static/description/assets/screenshots/scrnshot-1.png
  12. BIN
      product_volume/static/description/assets/screenshots/scrnshot-2.png
  13. 45
      product_volume/static/description/index.html
  14. 11
      product_volume/views/product_template_views.xml

2
product_volume/__manifest__.py

@ -21,7 +21,7 @@
################################################################################ ################################################################################
{ {
'name': 'Product Volume Calculation', 'name': 'Product Volume Calculation',
'version': '17.0.1.0.1', 'version': '17.0.1.1.0',
'category': "Inventory", 'category': "Inventory",
'summary': """This module will helps you to give dimensions of the product.""", 'summary': """This module will helps you to give dimensions of the product.""",
'description': "Module helps you to manage the length, breadth and height " 'description': "Module helps you to manage the length, breadth and height "

8
product_volume/doc/RELEASE_NOTES.md

@ -1,5 +1,11 @@
## Module <product_volume> ## Module <product_volume>
#### 21.12.2023
#### 24.11.2023
#### Version 17.0.1.0.0 #### Version 17.0.1.0.0
#### ADD #### ADD
- Initial Commit For Product Volume Calculation - Initial Commit For Product Volume Calculation
#### 22.12.2023
#### Version 17.0.1.1.0
#### UPDT
- Added selecting UOM option

1
product_volume/models/__init__.py

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

34
product_volume/models/product_product.py

@ -1,34 +0,0 @@
# -*- 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))

41
product_volume/models/product_template.py

@ -29,10 +29,47 @@ class ProductDimensionsVolume(models.Model):
length = fields.Char(string="Length", help="Enter length of the product") length = fields.Char(string="Length", help="Enter length of the product")
breadth = fields.Char(string="Breadth", help="Enter breadth of the product") breadth = fields.Char(string="Breadth", help="Enter breadth of the product")
height = fields.Char(string="Height", help="Enter height of the product") height = fields.Char(string="Height", help="Enter height of the product")
length_uom = fields.Selection(
selection=[('meters', 'Meters'), ('centimeters', 'Centimeters'),
('inches', 'Inches'), ('feet', 'Feet'), ('yards', 'Yards')],
string="UoM", default='meters', required=True,
help="Select the unit of measure for length and")
volume_uom = fields.Selection(
selection=[('cubic_meters', 'Cubic Meters'),
('cubic_inches', 'Cubic Inches'),
('cubic_feet', 'Cubic Feet'),
('cubic_yards', 'Cubic Yards')],
string="UoM of Volume", default='cubic_meters', required=True,
help="Select the unit of measure for volume")
@api.onchange('length', 'breadth', 'height') @api.onchange('length', 'breadth', 'height', 'length_uom', 'volume_uom')
def _onchange_product_measures(self): def _onchange_product_measures(self):
"""Onchange function to calculate volume of the product""" """Onchange function to calculate volume of the product"""
self.volume = (float(self.length if self.length else 0) * volume = 0
if self.length_uom == "meters":
volume = (float(self.length if self.length else 0) *
float(self.breadth if self.breadth else 0) * float( float(self.breadth if self.breadth else 0) * float(
self.height if self.height else 0)) self.height if self.height else 0))
elif self.length_uom == "centimeters":
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)) / 1000000)
elif self.length_uom == "inches":
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)) / 61023.7)
elif self.length_uom == "feet":
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)) / 35.3147)
elif self.length_uom == "yards":
volume = ((float(self.length or 0) * float(
self.breadth or 0) * float(self.height or 0)) / 1.308)
if self.volume_uom == 'cubic_meters':
self.volume = volume
if self.volume_uom == 'cubic_inches':
self.volume = volume * 61023.7
if self.volume_uom == 'cubic_feet':
self.volume = volume * 35.3147
if self.volume_uom == 'cubic_yards':
self.volume = volume * 1.308

BIN
product_volume/static/description/assets/screenshots/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
product_volume/static/description/assets/screenshots/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
product_volume/static/description/assets/screenshots/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
product_volume/static/description/assets/screenshots/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

BIN
product_volume/static/description/assets/screenshots/hero.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 216 KiB

BIN
product_volume/static/description/assets/screenshots/scrnshot-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

BIN
product_volume/static/description/assets/screenshots/scrnshot-2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

45
product_volume/static/description/index.html

@ -71,7 +71,7 @@
<div> <div>
<p style="color: #1A202C;font-weight: 600; <p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">Seamless Adding of Properties.</p> font-size: 1.2rem; margin-bottom: 2px;">Seamless Adding of Properties.</p>
<p class="m-0" style="color:#718096"> Length, Breadth and Height of the product in the product master page <p class="m-0" style="color:#718096">Length, Breadth and Height of the product in the product master page.
</p> </p>
</div> </div>
</div> </div>
@ -87,13 +87,14 @@
</div> </div>
<div> <div>
<p style="color: #1A202C;font-weight: 600; <p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">Automatic Calculation</p> font-size: 1.2rem; margin-bottom: 2px;">Automatic Calculation.</p>
<p class="m-0" style="color:#718096">Automatic calculation of volume with the above details <p class="m-0" style="color:#718096">Automatic calculation of volume with the above details.
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<div class="container rounded" > <div class="container rounded" >
<ul class="nav nav-tabs d-flex" style="width: fit-content;margin: 0 auto;gap: 1rem;"> <ul class="nav nav-tabs d-flex" style="width: fit-content;margin: 0 auto;gap: 1rem;">
<li class="col text-center py-2 text-nowrap " <li class="col text-center py-2 text-nowrap "
@ -119,7 +120,7 @@
<div <div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0"> <div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/scrnshot-1.png" class="img-responsive" width="100%" height="auto"> <img src="assets/screenshots/1.png" class="img-responsive" width="100%" height="auto">
</div> </div>
<div class="px-3"> <div class="px-3">
<h4 class="mt-2" <h4 class="mt-2"
@ -132,7 +133,20 @@
<div <div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0"> <div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/scrnshot-2.png" class="img-responsive" width="100%" height="auto"> <img src="assets/screenshots/2.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Option to choose the unit of measures.</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/3.png" class="img-responsive" width="100%" height="auto">
</div> </div>
<div class="px-3"> <div class="px-3">
<h4 class="mt-2" <h4 class="mt-2"
@ -141,9 +155,19 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/4.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Option to choose the unit of measure for volume.</h4>
</div>
</div>
</div>
</div> </div>
<div id="tab2" class="tab-pane fade"> <div id="tab2" class="tab-pane fade">
<div class="col-mg-12" style="padding: 1rem 4rem;"> <div class="col-mg-12" style="padding: 1rem 4rem;">
@ -158,7 +182,6 @@
<span style="margin-right: 12px;"><img src="assets/misc/star (1) 2.svg" alt="" <span style="margin-right: 12px;"><img src="assets/misc/star (1) 2.svg" alt=""
width="16px"></span>Automatic Calculation. width="16px"></span>Automatic Calculation.
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
@ -168,7 +191,7 @@
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3" style="font-size: 0.8rem; font-weight: 500;"><span>Version <div class="d-flex mb-3" style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.0</span><span class="px-2">|</span><span 17.0.1.0.0</span><span class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:13th November 2023</span> style="color: #714B67;font-weight: 600;">Released on:21th December 2023</span>
</div> </div>
<p class="m-0" <p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;"> style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">

11
product_volume/views/product_template_views.xml

@ -15,23 +15,24 @@
<label for="weight"/> <label for="weight"/>
<div class="o_row" name="weight" style="width: 40px;"> <div class="o_row" name="weight" style="width: 40px;">
<field name="weight"/> <field name="weight"/>
<field name="weight_uom_name"/> <span>kg</span>
</div> </div>
<label for="volume"/> <label for="volume"/>
<div name="volume"> <div name="volume">
<div class="o_row"> <div class="o_row">
<field name="length" style="width:65px;" <field name="length" style="width:55px;"
placeholder="Length"/> placeholder="Length"/>
<field name="breadth" style="width:65px;" <field name="breadth" style="width:55px;"
placeholder="Breadth"/> placeholder="Breadth"/>
<field name="height" style="width:65px;" <field name="height" style="width:55px;"
placeholder="Height"/> placeholder="Height"/>
<field name="length_uom" style="width:55px;"/>
</div> </div>
<br/> <br/>
<div class="o_row"> <div class="o_row">
<field name="volume" string="Volume" <field name="volume" string="Volume"
style="width: 40px;"/> style="width: 40px;"/>
<field name="volume_uom_name"/> <field name="volume_uom" style="width:25px;"/>
</div> </div>
</div> </div>
</group> </group>

Loading…
Cancel
Save