[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:
Goffin Simon 2015-05-20 12:38:44 +02:00
parent 49cb46fb78
commit 5a10903e9b
3 changed files with 14 additions and 2 deletions

View File

@ -1008,6 +1008,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;
@ -1026,7 +1027,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);
}
};

View File

@ -29,6 +29,7 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of
if (typeof amount === 'number') {
amount = round_di(amount,decimals).toFixed(decimals);
amount = openerp.instances[this.session.name].web.format_value(parseFloat(amount), { type : 'float' });
}
if (currency.position === 'after') {

View File

@ -873,7 +873,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_str()" />
<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_str()" />
<span class='paymentline-delete'>
<img src="/point_of_sale/static/src/img/search_reset.gif" />
</span>