Browse Source

May 20 [UPDT] : Updated 'product_multi_uom'

pull/317/head
AjmalCybro 11 months ago
parent
commit
47c72b726b
  1. 4
      product_multi_uom/__manifest__.py
  2. 5
      product_multi_uom/doc/RELEASE_NOTES.md
  3. 2
      product_multi_uom/models/__init__.py
  4. 4
      product_multi_uom/models/product_product.py
  5. 6
      product_multi_uom/models/sale_order_line.py
  6. 2
      product_multi_uom/models/secondary_uom_line.py
  7. BIN
      product_multi_uom/static/description/assets/screenshots/2.png
  8. BIN
      product_multi_uom/static/description/assets/screenshots/3.png
  9. BIN
      product_multi_uom/static/description/assets/screenshots/4.png
  10. BIN
      product_multi_uom/static/description/assets/screenshots/5.png
  11. BIN
      product_multi_uom/static/description/assets/screenshots/6.png
  12. BIN
      product_multi_uom/static/description/assets/screenshots/8.png
  13. 10
      product_multi_uom/views/product_product_views.xml

4
product_multi_uom/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': "Product Multi UoM", 'name': "Product Multi UoM",
'version': '17.0.1.0.0', 'version': '17.0.1.1.0',
'category': 'Sales', 'category': 'Sales',
'summary': 'This module help to sell a product with multiple Uom category', 'summary': 'This module help to sell a product with multiple Uom category',
'description': "This versatile module empowers your sales strategy by " 'description': "This versatile module empowers your sales strategy by "
@ -37,7 +37,7 @@
'depends': ['base', 'sale_management'], 'depends': ['base', 'sale_management'],
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/product_template_views.xml', 'views/product_product_views.xml',
'views/sale_order_line_views.xml', 'views/sale_order_line_views.xml',
], ],
'images': ['static/description/banner.png'], 'images': ['static/description/banner.png'],

5
product_multi_uom/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 17.0.1.0.0 #### Version 17.0.1.0.0
#### ADD #### ADD
- Initial Commit for Product Multi UoM - Initial Commit for Product Multi UoM
#### 22.05.2024
#### Version 17.0.1.1.0
#### UPDT
- Changed to Product variants level.

2
product_multi_uom/models/__init__.py

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

4
product_multi_uom/models/product_template.py → product_multi_uom/models/product_product.py

@ -22,9 +22,9 @@
from odoo import api, fields, models from odoo import api, fields, models
class ProductTemplate(models.Model): class ProductProduct(models.Model):
"""Inherits the 'product.template' for adding the secondary uom""" """Inherits the 'product.template' for adding the secondary uom"""
_inherit = "product.template" _inherit = "product.product"
is_need_secondary_uom = fields.Boolean(string="Need Secondary UoM's", is_need_secondary_uom = fields.Boolean(string="Need Secondary UoM's",
help="Enable this field for " help="Enable this field for "

6
product_multi_uom/models/sale_order_line.py

@ -50,16 +50,16 @@ class SaleOrderLine(models.Model):
"""Function that update the product_uom_qty as the value in the """Function that update the product_uom_qty as the value in the
secondary uom quantity""" secondary uom quantity"""
all_uom = [] all_uom = []
if self.product_template_id.is_need_secondary_uom: if self.product_id.is_need_secondary_uom:
self.is_secondary_readonly = True self.is_secondary_readonly = True
for uom in self.product_template_id.secondary_uom_ids: for uom in self.product_id.secondary_uom_ids:
all_uom.append(uom.secondary_uom_id.id) all_uom.append(uom.secondary_uom_id.id)
if self.is_secondary_readonly: if self.is_secondary_readonly:
self.product_uom_readonly = True self.product_uom_readonly = True
if self.secondary_product_uom_id.id in all_uom: if self.secondary_product_uom_id.id in all_uom:
primary_uom_ratio = self.env['secondary.uom.line'].search( primary_uom_ratio = self.env['secondary.uom.line'].search(
[('secondary_uom_id', '=', self.secondary_product_uom_id.id), [('secondary_uom_id', '=', self.secondary_product_uom_id.id),
('product_id', '=', self.product_template_id.id)]).mapped( ('product_id', '=', self.product_id.id)]).mapped(
'secondary_uom_ratio') 'secondary_uom_ratio')
converted_uom_qty = primary_uom_ratio[ converted_uom_qty = primary_uom_ratio[
0] * self.secondary_product_uom_qty 0] * self.secondary_product_uom_qty

2
product_multi_uom/models/secondary_uom_line.py

@ -34,7 +34,7 @@ class SecondaryUomLine(models.Model):
secondary_uom_id = fields.Many2one('uom.uom', string='Secondary UoM', secondary_uom_id = fields.Many2one('uom.uom', string='Secondary UoM',
help="Select the Secondary UoM", help="Select the Secondary UoM",
required=True) required=True)
product_id = fields.Many2one('product.template', readonly=True, product_id = fields.Many2one('product.product', readonly=True,
string="Product", string="Product",
help="Product having the Secondary UOM") help="Product having the Secondary UOM")
secondary_uom_ratio = fields.Float(string='Secondary UoM Ratio', secondary_uom_ratio = fields.Float(string='Secondary UoM Ratio',

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 145 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 154 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 140 KiB

BIN
product_multi_uom/static/description/assets/screenshots/5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 141 KiB

BIN
product_multi_uom/static/description/assets/screenshots/6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 156 KiB

BIN
product_multi_uom/static/description/assets/screenshots/8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 145 KiB

10
product_multi_uom/views/product_template_views.xml → product_multi_uom/views/product_product_views.xml

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<odoo> <odoo>
<!-- Inherits the product template view for adding the field for selecting the secondary Uom--> <!--Inherits the product variant view for adding the field for selecting the secondary Uom-->
<record id="product_template_only_form_view" model="ir.ui.view"> <record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.template.view.form.inherit.product.multi.uom</field> <field name="name">product.product.view.form.inherit.product.multi.uom</field>
<field name="model">product.template</field> <field name="model">product.product</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/> <field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='uom_po_id']" position="after"> <xpath expr="//field[@name='uom_po_id']" position="after">
<field name="is_need_secondary_uom" groups="uom.group_uom"/> <field name="is_need_secondary_uom" groups="uom.group_uom"/>
Loading…
Cancel
Save