-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD] New module <web_decimal_numpad_dot> #57
base: 8.0
Are you sure you want to change the base?
Conversation
Hola Ohiane, ¿Este módulo os funciona?, a mi me daba error e hice un cambio en el evento que se vigila, te pego el código con el que me funciona. (function() {
var instance = openerp;
instance.web.form.FieldFloat = instance.web.form.FieldChar.extend({
is_field_number: true,
widget_class: 'oe_form_field_float',
events: {
"keypress": "floatKeypress",
},
floatKeypress: function(e){
if(e.keyCode == '46' || e.charCode == '46'){
//Cancel the keypress
e.preventDefault();
// Add the comma to the value of the input field
this.$("input").val(this.$("input").val() + ',');
}
},
});
})(); Un saludo. |
@omar7r en realidad no llego a funcionar del todo, probaré y si funciona lo subo 😉 |
@omar7r probado, pero no hace lo que yo pretendía, si no que cambia el punto por la coma en TODOS los casos, mi intención era que el punto del teclado numérico funcionase como coma. Por lo demás muchas gracias serviría así. |
We installed the module web_decimal_numpad_dot last week. For data entry by the users, this works great. But we found an issue with displaying the data. We have set the decimal accuracy for f.e. “Product Price” to 4 digits. When this module is installed, it always only shows 2 digits for the product price. As soon as I uninstall the module, it’s showing again 4 digits. |
@oihane, please check this one. |
Can confirm @wim-a 's issue. Another thing, when the default value is 0,00, installing the module makes the field empty. If we they say, this product is 0,00 and save it it works. When we edit the line again the price field is empty again.
|
Hi, Try this new source code, because with the original you overwrite the default functionalities of float widget: (function() {
var instance = openerp;
instance.web.form.FieldFloat = instance.web.form.FieldFloat.extend({
render_value: function() {
var self = this;
this._super();
if (!this.get('readonly')){
this.$el.find('input').on('keypress', this.floatKeypress.bind(this));
}
},
floatKeypress: function(e){
if(e.keyCode == '46' || e.charCode == '46'){
//Cancel the keypress
e.preventDefault();
// Add the comma to the value of the input field
this.$("input").val(this.$("input").val() + ',');
}
},
});
})(); |
Hello, I tested it. This works great now. Thanks a lot. Best regards, Wim From: omar7r [mailto:[email protected]] Hi, Try this new source code, because with the original you overwrite the default functionalities of float widget: (function() { var instance = openerp; instance.web.form.FieldFloat = instance.web.form.FieldFloat.extend({ })(); — |
Hello, I tested it with the new code. This works great now. Thanks a lot. Best regards, |
This breaks things for the English user, I can no longer enter 1.5 or 1,5. But, the problem with empty fields is fixed :) |
Solved it by doing the replace only when the decimal point is an , :
Added check after the keycode is the right one, but speed doesn't seem to matter. |
Changed again, it was supposed to do the replacement only when pressing the dot from de numpad, but it seems that keypress does not distinguish between simple dot and numpad dot |
Great work Oihane. I have detected a bug. When you put a product in the line, a put the price it put two or more commas instead of one. I have replicate the bug in sale order, purchase order and invoice. Also I have some controls with console and I have detect when you push the keys of the float field the function floatKeypress receive the key two or more times, not only the dot key also the number keys. I think that the problem is when the product_id change it open two capture keys events or browser cache. I go to investigate but if somebody have any idea, it can help. Greetings |
Hello, First I want to wish you all a happy new year. We have the same problem. I don’t think that it has to do with product_id change, as it also happens on screens where no product_id is defined. I have been looking further into it, and it looks to me that it depends on the length of the keypress. With some users, it almost never happens, and other users have it very frequently, even when both users use the same screens. Best regards, Wim From: Odoo - OpenERP - Acysos S.L. [mailto:[email protected]] Great work Oihane. I have detected a bug. When you put a product in the line, a put the price it put two or more commas instead of one. I have replicate the bug in sale order, purchase order and invoice. Also I have some controls with console and I have detect when you push the keys of the float field the function floatKeypress receive the key two or more times, not only the dot key also the number keys. I think that the problem is when the product_id change it open two capture keys events. I go to investigate but if somebody have any idea, it can help. Greetings — |
Is there any news about this bug? Best regards, Wim |
Looks that I resolved the problem. I'm not an experienced js developer, but I have changed the floatKeyPress function as follows, and it looks to work well..
|
@wim-a but using that code if module is installed and a user is working in other language that uses . as decimal point and no , it will not be able to work properly. My idea was to change this functionality only using the dot of the num pad, but I didn't manage to do it so, many other things to do, this is the last of the list. Thanks for your contribution. |
Yes, oihane, I agree with what you write there. This code should be modified so that it also works in other languages. My highest priority with this issue was to solve it for my own users. Some of them have this problem many times per day. I already wanted to share how I changed it so that other customers, also using a decimal comma and having the same problem, can resolve it until there is a final solution working for all languages. |
What's the status of this? Can somebody summarize? |
Buen Dia, me podrian ayudar a resolver como puedo eliminar de los precios de los productos los dos ceros decimales sobres ejemplo 15.000,00 quisiera que no saliera estos dos digitos ,00 . |
fc36d95
to
d6b394a
Compare
No description provided.