-
-
Notifications
You must be signed in to change notification settings - Fork 600
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
[12.0] pos_tare - Uncaught TypeError #978
Comments
Thanks for reporting and the extensive analysis. |
done |
thanks ! |
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Fixed by #979. Closing. |
Stacktrace in pos when selecting a product to weight
Module
pos_tare
Describe the bug
For a POS with Tare Input Method = Scan a barcode to set the tare I get a stacktrace when I choose Cheese by the Slice product (from demo data) because id input_weight_tare cannot be found in the view.
Uncaught TypeError: Cannot set properties of undefined (setting 'value')
http://localhost:8069/pos_tare/static/src/js/screens.js:51
Traceback:
TypeError: Cannot set properties of undefined (setting 'value')
at Class.show (http://localhost:8069/pos_tare/static/src/js/screens.js:51:55)
at Class.show (http://localhost:8069/web/static/src/js/core/class.js:123:38)
at Class.show_screen (http://localhost:8069/point_of_sale/static/src/js/gui.js:116:33)
at Class.click_product (http://localhost:8069/point_of_sale/static/src/js/screens.js:1089:21)
at Object.click_product_action (http://localhost:8069/point_of_sale/static/src/js/screens.js:1062:59)
at HTMLElement.click_product_handler (http://localhost:8069/point_of_sale/static/src/js/screens.js:899:21)
In pos_tare, the problematic line is:
this.$("#input_weight_tare")[0].value = this.tare;
To Reproduce
Affected versions: 12.0
Steps to reproduce the behavior:
Expected behavior
No stacktrace
Additional context
I managed to reproduce on runboat and on local.
Proposition to resolve the issue
The problem is pretty easy to understand:
show
method is called in js and goes through the problematic line only if there is a tare onthis
. Since cheese by the slice has a default tare, there is a tare onthis
. Problem is there is no id input_weight_tare in the view because in the template we show this input only when pos.config.iface_tare_method != 'barcode'.One way to fix this would be to adapt
it could become
The text was updated successfully, but these errors were encountered: