Browse Source

Nov 21: [FIX] Bug Fixed 'product_multi_uom_pos'

pull/301/merge
Cybrosys Technologies 5 months ago
parent
commit
a92fdb1c62
  1. 4
      product_multi_uom_pos/__manifest__.py
  2. 5
      product_multi_uom_pos/doc/RELEASE_NOTES.md
  3. 15
      product_multi_uom_pos/models/product_template.py
  4. 5
      product_multi_uom_pos/static/src/js/Orderline.js
  5. 7
      product_multi_uom_pos/static/src/xml/Orderline.xml
  6. 14
      product_multi_uom_pos/views/product_template_views.xml

4
product_multi_uom_pos/__manifest__.py

@ -21,7 +21,7 @@
#############################################################################
{
'name': "POS Product Multiple UOM",
'version': '16.0.1.0.0',
'version': '16.0.1.1.1',
'category': 'Point of Sale',
'summary': """A module to manage multiple UoM in POS""",
'description': """This app allows you to change UoM of product in POS.""",
@ -29,7 +29,7 @@
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['base', 'point_of_sale'],
'depends': ['base', 'point_of_sale', 'uom'],
'data':
[
'security/ir.model.access.csv',

5
product_multi_uom_pos/doc/RELEASE_NOTES.md

@ -15,3 +15,8 @@
#### Version 16.0.1.0.0
#### FIX
- Added UOM in Sales details report.
#### 21.11.2024
#### Version 16.0.1.1.1
#### FIX
- The price calculation has been updated. Previously, the unit of measure (UOM) price was determined based on the price specified for the UOM. Now, it is calculated based on the product's base price.

15
product_multi_uom_pos/models/product_template.py

@ -27,14 +27,21 @@ class ProductTemplate(models.Model):
of measure"""
_inherit = 'product.template'
product_uom_category_id = fields.Many2one(related='uom_id.category_id')
pos_multi_uom_ids = fields.Many2many('uom.uom', 'product_template_id',
string="POS Multiple UoM",
domain="[('category_id', '=', product_uom_category_id)]",
help='These UoM can be selected from '
'PoS')
multi_uom = fields.Boolean(compute='_compute_multi_uom', string='Multi UoM',
help='A boolean field to show the one2many field'
'POS Multiple UoM if the Multi UoM option'
' is enabled in Configuration settings')
pos_multi_uom_ids = fields.One2many('pos.multi.uom', 'product_template_id',
string="POS Multiple UoM",
help='These UoM can be selected from '
'PoS')
# pos_multi_uom_ids = fields.One2many('pos.multi.uom', 'product_template_id',
# string="POS Multiple UoM",
# help='These UoM can be selected from '
# 'PoS')
def _compute_multi_uom(self):
"""

5
product_multi_uom_pos/static/src/js/Orderline.js

@ -12,7 +12,10 @@ odoo.define('product_multi_uom_pos.multi_uom_pos', function(require) {
// Retrieve the available unit of measure options based on the product's multi_uom_ids
getUom() {
const filteredData = this.props.line.pos.pos_multi_uom.filter(obj => this.props.line.product.pos_multi_uom_ids.includes(obj.id));
console.log(this)
console.log("this",this.props.line.product.pos_multi_uom_ids)
const filteredData = this.props.line.pos.units.filter(obj => this.props.line.product.pos_multi_uom_ids.includes(obj.id))
console.log("filtereddata",filteredData)
return filteredData
}

7
product_multi_uom_pos/static/src/xml/Orderline.xml

@ -10,11 +10,10 @@
<option value="change_uom" id="change_uom" selected="selected" disabled="disabled">Change UoM</option>
<t t-foreach="getUom()" t-as="item" t-key="item.id">
<option id="select_uom" class="select_uom"
t-att-value="[item.price,item.uom_id[0],item.uom_id[1]]">
t-att-value="[item.ratio * this.props.line.product.lst_price,item.id]">
<div><span>
<t t-esc="this.props.line.product.pos.currency.symbol"/>
<t t-esc="item.price"/> per
<t t-esc="item.uom_id[1]"/></span></div>
<t t-esc="item.name"/>
</span></div>
</option>
</t>
</select>

14
product_multi_uom_pos/views/product_template_views.xml

@ -2,19 +2,15 @@
<odoo>
<!-- Adding new field 'pos_multi_uom_ids' to Product view-->
<record id="product_template_only_form_view" model="ir.ui.view">
<field name="name">product.template.view.form.inherit.product.multi.uom.pos</field>
<field name="name">
product.template.view.form.inherit.product.multi.uom.pos
</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="model">product.template</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='pos_categ_id']" position="after">
<field name="multi_uom" invisible="1"/>
<field name="pos_multi_uom_ids" attrs="{'invisible':[('multi_uom','=',False)]}">
<tree editable="bottom">
<field name="uom_id"/>
<field name="price"/>
<field name="category_id" invisible="1"/>
</tree>
</field>
<field name="pos_multi_uom_ids" widget="many2many_tags"/>
<field name="product_uom_category_id"/>
</xpath>
</field>
</record>

Loading…
Cancel
Save