Browse Source

May 09: [FIX] Bug Fixed 'product_multi_uom_pos'

pull/317/head
RisvanaCybro 12 months ago
parent
commit
386d985fb5
  1. 2
      product_multi_uom_pos/__manifest__.py
  2. 5
      product_multi_uom_pos/doc/RELEASE_NOTES.md
  3. 1
      product_multi_uom_pos/models/product_template.py
  4. 15
      product_multi_uom_pos/static/src/overrides/generic_components/orderline/orderline.xml
  5. 13
      product_multi_uom_pos/static/src/overrides/models/orderline.js

2
product_multi_uom_pos/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': "POS Product Multiple UOM", 'name': "POS Product Multiple UOM",
'version': '17.0.1.0.0', 'version': '17.0.1.0.1',
'category': 'Point of Sale', 'category': 'Point of Sale',
'summary': """A module to manage multiple UoM in POS""", 'summary': """A module to manage multiple UoM in POS""",
'description': """Using this app, you can change unit of measure of 'description': """Using this app, you can change unit of measure of

5
product_multi_uom_pos/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 POS Product Multiple UOM - Initial commit for POS Product Multiple UOM
#### 9.05.2024
#### Version 17.0.1.0.1
##### UPDT
- Bug Fix-Resolved the issue in the refund page.

1
product_multi_uom_pos/models/product_template.py

@ -43,6 +43,7 @@ class ProductTemplate(models.Model):
""" """
status = self.env['ir.config_parameter'].sudo().get_param( status = self.env['ir.config_parameter'].sudo().get_param(
'product_multi_uom_pos.pos_multi_uom') 'product_multi_uom_pos.pos_multi_uom')
print(status,'status')
self.write({ self.write({
'multi_uom': status 'multi_uom': status
}) })

15
product_multi_uom_pos/static/src/overrides/generic_components/orderline/orderline.xml

@ -5,23 +5,22 @@
t-inherit="point_of_sale.Orderline" t-inherit="point_of_sale.Orderline"
t-inherit-mode="extension" owl="1"> t-inherit-mode="extension" owl="1">
<xpath expr="//ul[hasclass('info-list')]" position="after"> <xpath expr="//ul[hasclass('info-list')]" position="after">
<t t-if="line.getUom(this).length != 0"> <t t-if="line.onSelectionChangedUom and line.getUom(this).length != 0">
<t t-log="this"/>
<button id="reset_uom" style="margin-top: 15px; background:transparent;border:transparent; <button id="reset_uom" style="margin-top: 15px; background:transparent;border:transparent;
margin-bottom: 5px;margin-left: 180px;" margin-bottom: 5px;margin-left: 180px;"
t-on-click="line.resetUom"> t-on-click="line.resetUom">
<i class="fa fa-rotate-left"/> <i class="fa fa-rotate-left"/>
</button> </button>
<select style="width:32%;height:25px;border-radius:5px;border:1px solid transparent;margin-top: -22px; <select style="width:32%;height:25px;border-radius:5px;border:1px solid transparent;margin-top: -22px;
margin-bottom: 5px;margin-left: 10px; background: rgb(95 115 116 / 20%);" margin-bottom: 5px;margin-left: 10px; background: rgb(95 115 116 / 20%);"
id="select_uom" class="select_uom" id="select_uom" class="select_uom"
t-on-change="line.onSelectionChangedUom" t-on-change="line.onSelectionChangedUom"
t-ref="uom_value"> t-ref="uom_value">
<option value="change_uom" id="change_uom" <option value="change_uom" id="change_uom"
selected="selected" selected="selected"
disabled="disabled">Change UoM</option> disabled="disabled">Change UoM</option>
<t t-foreach="line.getUom(this)" t-as="item" <t t-foreach="line.getUom(this)" t-as="item"
t-key="item.id"> t-key="item.id">
<option id="select_uom" <option id="select_uom"
class="select_uom" class="select_uom"
t-att-value="[item.price,item.uom_id[0],item.uom_id[1]]"> t-att-value="[item.price,item.uom_id[0],item.uom_id[1]]">

13
product_multi_uom_pos/static/src/overrides/models/orderline.js

@ -1,7 +1,7 @@
/** @odoo-module */ /** @odoo-module */
import { patch } from "@web/core/utils/patch"; import { patch } from "@web/core/utils/patch";
import { Orderline } from "@point_of_sale/app/store/models"; import { Orderline, Order } from "@point_of_sale/app/store/models";
patch(Orderline.prototype, { patch(Orderline.prototype, {
export_as_JSON(){ export_as_JSON(){
@ -17,10 +17,12 @@ patch(Orderline.prototype, {
init_from_JSON(json){ init_from_JSON(json){
super.init_from_JSON(...arguments); super.init_from_JSON(...arguments);
// Set the product_uom_id from the JSON data // Set the product_uom_id from the JSON data
if(this.pos.units_by_id[json.product_uom_id]){
this.product_uom_id = { this.product_uom_id = {
0 : this.pos.units_by_id[json.product_uom_id].id, 0 : this.pos.units_by_id[json.product_uom_id].id,
1 : this.pos.units_by_id[json.product_uom_id].name, 1 : this.pos.units_by_id[json.product_uom_id].name,
}; };
}
}, },
// Add a custom set_uom method // Add a custom set_uom method
set_uom(uom_id){ set_uom(uom_id){
@ -39,7 +41,7 @@ patch(Orderline.prototype, {
return this.pos.units_by_id[unit_id]; return this.pos.units_by_id[unit_id];
} }
return this.product.get_unit(); return this.product.get_unit();
}, },
onSelectionChangedUom(ev) { onSelectionChangedUom(ev) {
var splitTargetValue = ev.target.value.split(',') var splitTargetValue = ev.target.value.split(',')
var price = splitTargetValue[0] var price = splitTargetValue[0]
@ -75,3 +77,10 @@ patch(Orderline.prototype, {
}; };
}, },
}); });
patch(Order.prototype, {
export_for_printing() {
var result = super.export_for_printing(...arguments);
result['orderlines'] = result['orderlines'].map(({ onSelectionChangedUom, ...rest }) => rest);
return result;
},
});
Loading…
Cancel
Save