[FIX] point_of_sale: Language not in en_US

When the user is not in en_US language, unit_name is always different of Unit

opw:2581462

closes odoo/odoo#73847

X-original-commit: 2da20136988afaa93f472da4726091452c61cd37
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Goffin Simon
2021-07-16 11:11:27 +00:00
parent dca79a966a
commit dc7678ea15
3 changed files with 11 additions and 2 deletions
@@ -30,7 +30,7 @@ odoo.define('point_of_sale.OrderReceipt', function(require) {
isSimple(line) {
return (
line.discount === 0 &&
line.unit_name === 'Units' &&
line.is_in_unit &&
line.quantity === 1 &&
!(
line.display_discount_policy == 'without_discount' &&
@@ -68,6 +68,7 @@ exports.PosModel = Backbone.Model.extend({
this.config = null;
this.units = [];
this.units_by_id = {};
this.uom_unit_id = null;
this.default_pricelist = null;
this.order_sequence = 1;
window.posmodel = this;
@@ -210,6 +211,13 @@ exports.PosModel = Backbone.Model.extend({
self.units_by_id[unit.id] = unit;
});
}
},{
model: 'ir.model.data',
fields: ['res_id'],
domain: function(){ return [['name', '=', 'product_uom_unit']]; },
loaded: function(self,unit){
self.uom_unit_id = unit[0].res_id;
}
},{
model: 'res.partner',
label: 'load_partners',
@@ -1905,6 +1913,7 @@ exports.Orderline = Backbone.Model.extend({
id: this.id,
quantity: this.get_quantity(),
unit_name: this.get_unit().name,
is_in_unit: this.get_unit().id == this.pos.uom_unit_id,
price: this.get_unit_display_price(),
discount: this.get_discount(),
product_name: this.get_product().display_name,
@@ -82,7 +82,7 @@
</t>
<div class="pos-receipt-left-padding">
<t t-esc="Math.round(line.quantity * Math.pow(10, env.pos.dp['Product Unit of Measure'])) / Math.pow(10, env.pos.dp['Product Unit of Measure'])"/>
<t t-if="line.unit_name !== 'Units'" t-esc="line.unit_name" />
<t t-if="!line.is_in_unit" t-esc="line.unit_name" />
x
<t t-esc="env.pos.format_currency_no_symbol(line.price_display_one)" />
<span class="price_display pos-receipt-right-align">