[FIX] point_of_sale: float format
The POS must adapt the float format according to
the language of the user. Inspired from 1da5d89ba3
opw:639567
This commit is contained in:
parent
6026c2f4d0
commit
2c0529858f
|
@ -885,6 +885,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
|||
},this);
|
||||
|
||||
this.bind_events();
|
||||
this.decimal_point = instance.web._t.database.parameters.decimal_point;
|
||||
|
||||
this.line_delete_handler = function(event){
|
||||
var node = this;
|
||||
|
@ -903,7 +904,14 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
|||
node = node.parentNode;
|
||||
}
|
||||
if(node){
|
||||
node.line.set_amount(this.value);
|
||||
var amount;
|
||||
try{
|
||||
amount = instance.web.parse_value(this.value, {type: "float"});
|
||||
}
|
||||
catch(e){
|
||||
amount = 0;
|
||||
}
|
||||
node.line.set_amount(amount);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -31,6 +31,7 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of
|
|||
if(typeof amount === 'number'){
|
||||
amount = Math.round(amount*100)/100;
|
||||
amount = amount.toFixed(decimals);
|
||||
amount = openerp.instances[this.session.name].web.format_value(parseFloat(amount), { type : 'float' });
|
||||
}
|
||||
if(this.currency.position === 'after'){
|
||||
return amount + ' ' + (this.currency.symbol || '');
|
||||
|
|
|
@ -588,7 +588,10 @@
|
|||
<div class='paymentline-name'>
|
||||
<t t-esc="line.name"/>
|
||||
</div>
|
||||
<input class='paymentline-input' type="number" step="0.01" t-att-value="line.get_amount().toFixed(2)" />
|
||||
<input class='paymentline-input'
|
||||
t-att-type="widget.decimal_point === '.' ? 'number' : 'text'"
|
||||
t-attf-pattern="[0-9]+([\\#{widget.decimal_point || '.' }][0-9]+)?"
|
||||
step="0.01" t-att-value="line.get_amount().toFixed(2)" />
|
||||
<span class='paymentline-delete'>
|
||||
<img src="/point_of_sale/static/src/img/search_reset.gif" />
|
||||
</span>
|
||||
|
|
Loading…
Reference in New Issue