Commit Graph

739 Commits

Author SHA1 Message Date
Joren Van Onder 7f260ab517
[FIX] point_of_sale: round product.product price analogous to backend
A rounding issue was resolved in
ee33593351. It however introduced
another issue.

Rounding functions (both round_precision in web.utils and float_round
in openerp.tools) are not perfect due to IEEE floating point
limitations. However both should produce the same output given the
same input. An example: rounding 13.95 to 2 digits yields
13.950000000000001.

The additional rounding introduced in
ee33593351 on price lead to issues in
certain cases. One example occurs when applying a 90% discount on a
product costing 13.95. The POS will do the following:

> 13.950000000000001 * 0.09999999999999998
1.3949999999999998
> round_pr(1.3949999999999998, .01)
1.4000000000000001

whereas the backend will do (as eg. in sale.order.line)

>>> 13.95 * 0.09999999999999998
1.3949999999999996
>>> round(1.3949999999999996, 2)
1.3900000000000001

Causing a difference of 0.01.

The core of the issue is that in the backend 13.95 is rounded
differently. When a Float gets written to the database doesn't just
pass through the regular float_round. It passes through
_symbol_set_float which truncates characters exceeding the precision.

This implements the same approach in the POS.

opw-715506
Closes #16119
2017-03-29 10:45:43 +02:00
Joren Van Onder c0817016d2 [FIX] point_of_sale: fix country selection on touch events
The POS uses FastClick to circumvent the 300ms touch delay implemented
by browsers before a click event is fired. (Although this has since been
removed, probably we can get rid of this in the POS at some point as
well [1]).

The way FastClick works is simple: immediately fire a synthetic event
and block the one fired by the browser 300ms later.

Recently, browsers have started to only trust native events to trigger
default actions [2][3]. Chrome in particular has started not trusting
synthetic events since v53.

FastClick provides a solution for this with the needsclick class. It
will not interfere with events triggered on elements with this class.

[1] https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away
[2] https://w3c.github.io/uievents/#trusted-events
[3] https://www.chromestatus.com/features/5718803933560832

Fixes #14886
2017-02-02 09:46:48 -08:00
Joren Van Onder d043fd03ce [FIX] point_of_sale: display correct uom on weighable products
Everything's displayed fine on orderlines with weighable products, this
only affected the small blue labels on the products.

opw-674264
2016-04-20 11:09:07 +02:00
Joren Van Onder 9fa53b7ee7 [FIX] point_of_sale: adapt to Chrome 50's new handling of cell heights
Chrome 50 treats percent-height divs inside of auto-height cells as
auto [1]. So from now on it's important that an explicit 'height: 100%' CSS
property is set on parent tds, otherwise you'll end up with elements
with a height of 0.

An extra difficulty is that this new height property on
subwindow-container will result in the element being as high as his
parent table. So the collapsed trick doesn't work anymore in the
customer list.

This has to be done conditionally. The proposed workaround of adding
100% height to parents of affected elements causes issues in IE/Edge
because the effect of adding a height in percent to a table-{cell,row}
element is not defined by CSS [2].

DO NOT FORWARD-PORT!

[1] 8876584335
[2] http://stackoverflow.com/a/27384730
2016-04-19 08:53:10 +02:00
Joren Van Onder 591d74becf [FIX] point_of_sale: do not select payment input when hidden
Edge >=12 throws an error (code 800a025e) when calling the select()
method on an input element that is not currently part of document and
has a non-empty value.

When adding a paymentline a "change:selected_paymentline" event gets
triggered which in turn triggers the focus_selected_line function before
the actual paymentline gets rendered.

opw-671426
2016-03-09 09:13:44 +01:00
Joren Van Onder dda904c133 [FIX] point_of_sale: avoid '.' thousands separator issues
When we render the payment screen the current value of the current
paymentline is rendered to a string using
Paymentline.get_amount_str(). This conversion always rendered numbers
with a decimal separator of '.' because it just used
Number.toFixed(). This used to be fine but
5a10903e9b made the POS adhere to the set
decimal and thousands separator. Because of this, the POS now has to
parse the input with web.parse_value() which takes into account these
separators. When parse_value() parses a float it first deletes the
thousands separators and then replaces the decimal separator with '.'
before it gets cast to a Number.

In German (and other languages), the '.' is used as a thousands
separator which means that it will get deleted by parse_value() so
you'll end up with '12.34' being interpreted as '1234'. Because of this
it is important that we ensure that the default value that appears in
the input uses the correct separators.

The aforementioned issue only occurs when the user changes the default
value in the paymentline. Only then does a conversion take place from
String to Number. So just clicking on a payment method of type 'Bank'
and validating it would work fine, only when the payment amount was
updated would the issue occur.

Fixes #9395
Closes #10952

note: this should not be forward-ported to >8.0 because later versions
use the rewritten payment screen which is completely different from the
one in 8.0.
2016-03-01 09:38:07 +01:00
Joren Van Onder feedb0f1f4 [FIX] point_of_sale: get the correct logo when using multiple databases
In an environment where multiple database are available the company_logo
controller in the web module will return a placeholder logo (the Odoo
logo) if it can't figure out what db the request belongs to. This logo
is used on the ESC/POS receipts.

Because we load the logo with an anonymous CORS request there is no
authentication on the request. This is necessary because the POS tends
to not be served over HTTPS whereas the rest of Odoo is. Without this
crossOrigin attribute we could potentially end up in a situation where
the canvas is considered tainted by the browser which would prevent us
from extracting the canvas' data with toDataURL(). So removing the
crossOrigin attribute is not an option, specifying the db is the next
best thing.

opw-670471

note: in >=9.0 session is a variable defined in the js module instead of
a property on PosModel, so 'self.session.db' should become 'session.db'.
2016-02-29 09:57:39 +01:00
Nicolas Martinelli ee33593351 [FIX] point_of_sale: round price unit
The product price unit should be rounded before being used in any
operation. The PoS calls the method `read` in order to get the necessary
fields. However, the product price is a non-stored calculated float. In
old API, such a field is not rounded by the `read` method. It means that
a product price of 28.067 (for example thanks to the use of a pricelist)
will be rounded to 28.07 at the server level but not rounded in the PoS
JS layer.

To lower the impact of the fix, the rounding is done at the JS level,
and not in the `_product_price` method.

opw-669024
2016-02-23 14:38:09 +01:00
Joren Van Onder 963edc634f [FIX] point_of_sale: remove references to self-checkout in docs
Version 7 (and saas-3) had a self-checkout mode that was removed in
8. There are still some fields that reference the feature in
point_of_sale.py but they're obsolete and unused in the
frontend.

Both README.md and static/description/index.html (and thus
odoo.com/apps) still referenced these features.

opw-666328
2016-01-11 15:04:23 +01:00
Juan Carlos Montoya 2fa03885ed [FIX] point_of_sale: make uploading partner images work in Firefox
When uploading an image in the client list in the POS with Firefox an
error was thrown complaining about event not being defined.

jov note: the reason it worked in other browsers like IE and Chrome is
that in those browsers `event` resolves to `window.event`. In Firefox
this doesn't happen which is why JQuery provides us with the event in
the callback function.

closes #10078
2015-12-24 09:02:34 +01:00
Joren Van Onder dfb0e4b8f1 [FIX] point_of_sale: subtotal non ESC/POS receipt shouldn't include tax
On the PosTicket receipt (non-ESC/POS receipt) we have a line titled
subtotal. The subtotal was calculated with getSubtotal(). The issue is
that getSubtotal() ends up just using the price of the product. This
doesn't make sense when taxes are included in the price, because then
the subtotal will contain taxes.

It's not an issue on the ESC/POS receipt, because there we don't show
the subtotal at all if we only have included taxes.

fixes #10137
opw-660266
2015-12-23 14:50:15 +01:00
Denis Ledoux 261ccf7c56 [FIX] point_of_sale: quantity uses decimal separator of lang
This revision is related to 5a10903e9b.

The above revision makes so the decimal separator from the language
is used to display the prices.

This revision makes so this decimal separator is used as well
for quantities, to be coherent.

opw-657591
2015-11-27 17:26:31 +01:00
Denis Ledoux 4b003afd0a [FIX] point_of_sale: quantity decimals for new lines
In the pos interface,
when adding a product to the order,
the quantity was set to `1`,
but, when adding the same product again,
the quantity was set to `2.000`.

We use `set_quantity` to not
copy/paste what is already done
in this method to display
correctly the quantity within
the product unit of measure rounding.
2015-11-27 16:55:00 +01:00
Nicolas Lempereur 4626240d5d [FIX] point_of_sale: don't read for barcode when search focused
The product search field already handle product scanned by a code bar
(by adding it if it corresponds to only one product to the order) so
when the barcode is entered in this search input, the scan doesn't need to
be done.

closes #8433
opw-648856
2015-09-09 12:10:59 +02:00
Goffin Simon f4e6dba097 [FIX] point_of_sale: barcode_reader
In the POS, when trying to add a new product in an order
with an already printed ticket, the added product must be
add in a new order.

opw:647499
2015-08-31 13:43:33 +02:00
Nicolas Lempereur 96f0c28b3d [FIX] point_of_sale: unknown customer translation
The string "Unknown Customer" in the point_of_sale could not be
translated.

opw-645977
2015-07-28 17:17:04 +02:00
Julien Legros a8c6e666fa [FIX] point_of_sale: load disabled uoms
this is needed when selling products with a disabled uom
2015-07-24 12:05:42 +02:00
Goffin Simon 569d051f0b [FIX] point of sale: tax fixed
In backend, the method "_unit_compute" doesn't round the fixed tax amount
before adding to "cur_price_unit" in the case "tax.include_base_amount".

opw:644421
2015-07-17 14:09:02 +02:00
Alexis de Lattre cee6ed33ac [IMP] point_of_sale: add 'name' of res.currency in pre-loaded fields
Fixes #7367
2015-07-02 10:57:51 +02:00
Goffin Simon 56d832dbc5 [FIX] point of sale: rounding globally
The price without taxe must be rounded on each line like 'price_subtotal' in "sale.order.line"
with digits_compute= dp.get_precision('Account').
The total taxes included must be the sum of the rounded total without taxe and
the rounded taxes like in "sale.order" in _amount_all.

opw:643254
2015-06-29 09:02:10 +02:00
Tam Vu 6cb3fe43ed [FIX] point of sale: order undefined
If the line is linked to an order, this line must be removed in this order.
2015-06-26 14:02:59 +02:00
Stéphane Bidoul (ACSONE) 4213eebe2e [FIX] point_of_sale: correctly split workds in product search
The JS replace method, unlike python's, only replaces the first occurence
unless a search pattern is provided.

Closes #6302
2015-06-26 08:51:25 +02:00
Frédéric van der Essen 018435c6d7 [IMP] point_of_sale: contributing partners demo data. 2015-06-16 12:52:02 +02:00
Goffin Simon e208fe51db [FIX] point_of_sale: precision
Regression introduced by 5a10903.
2015-06-11 08:45:17 +02:00
Frédéric van der Essen 19eda68547 [IMP] web, point_of_sale: basic implementation of the cordova integration.
This time without a new js file
2015-05-29 15:33:13 +02:00
Goffin Simon 716fec913a [FIX] point of sale: Customer's country
When editing a customer, the actual country of the customer must be shown.

opw:639863
2015-05-28 08:18:21 +02:00
Frédéric van der Essen da378722cc Revert "[IMP] web, point_of_sale: basic implementation of the cordova integration."
This reverts commit f7a1ac8b06.
The commit introduced a change that required a database update,
which should not be required in a stable version.
2015-05-27 13:46:26 +02:00
Frédéric van der Essen f7a1ac8b06 [IMP] web, point_of_sale: basic implementation of the cordova integration. 2015-05-27 11:59:13 +02:00
Goffin Simon 5a10903e9b [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
2015-05-21 09:02:13 +02:00
Goffin Simon c5a613840f [FIX] point of sale: function is_paid:
When rounding globally, the function compute_all in charge to compute the taxes for
each line uses a very high currency rounding to avoid rounding per line.
The round must be done on the sum of each total amount line with taxes. To validate a payment with the pos,
the function is_paid verified that this sum is the same that the amount just paid.
Inspired from "sale.order.line", the precision of 'price_unit' and 'price_subtotal' in "pos.order.line"
must be taken from 'Product Price' to avoid rounding per line.

ps: we could not use the function get_all_prices to round globally because it used on every line.

Fixes #6681
Closes #6682
opw:639686
2015-05-19 09:41:51 +02:00
Denis Ledoux 6b72008c32 [FIX] point_of_sale: products search with ':' in products names
This is related to revision bb913d0.

':' in product names are removed, to avoid issues when
searching products with ':' in their name.

JS replace method only replaces the first occurence, if the
needle isn't set as a regex with 'g', e.g. /':'/g

opw-634547
2015-05-06 14:04:34 +02:00
Goffin Simon fc132665d7 [FIX] point of sale: Rounding method
By default, the point of sale awlways uses the rounding method per line.
But the accounting configuration allows to use the globally rounding method,
this is why the point of sale must consider this configuration.
Inspired from the compute_all of account.tax model within
addons/account/account.py.

opw:632537
2015-04-20 08:41:41 +02:00
Martin Trigaux 58a481329e [FIX] point_of_sale: child taxes computation
The box "Tax on children" was ignored in the pos, leading to 100% taxes for these
taxes (as amount is 1.0 on these taxes).

Add child tax fields when loading the pos to be able to correctly compute
recusively the tax amount on children.

Courtesy of Jean-Nicolas Brunet
Fixes #1515, lp:1231574, opw 622143
2015-04-16 09:33:53 +02:00
Frédéric van der Essen 12b6719423 Revert "[IMP] point_of_sale : display change amount after print if not 0"
This reverts commit 46ad2ac70f.
2015-04-07 14:47:47 +02:00
Martin 46ad2ac70f [IMP] point_of_sale : display change amount after print if not 0 2015-04-01 16:55:23 +02:00
Yenthe666 51ea2a3dde [FIX] point_of_sale: missing translation for invoice button
Fixes #4863
2015-01-27 11:44:44 +01:00
Frédéric van der Essen 932257150b [FIX] point_of_sale: scale debug was not working with an unplugged scale 2015-01-27 10:58:58 +01:00
Aaron Bohy 3cae676619 [FIX] Use local copies of png instead of fetching them from websites
Debian does not allow fetching data from external website at runtime.
This fixes the privacy-breach-generic lintian warnings for Debian packaging.
The removed youtube url was a dead link...
2015-01-23 11:23:04 +01:00
Aaron Bohy 2a39214d2e [FIX] File permission: remove unnecessary executable perm on files
Some .xml,.csv,.po,.woff,.ttf,.png,.eot,.svg had perm 755, provocating
'executable-not-elf-or-script' lintian warning for Debian packaging.
Set permission to 644 for those files.
Also remove unnecessary executable permissions on some .py:
	-addons/l10n_fr_hr_payroll/report/fiche_paye.py
	-addons/l10n_ro/res_partner.py
	-addons/l10n_ro/__openerp__.py
	-addons/l10n_ro/__init__.py
	-addons/l10n_do/__openerp__.py
	-addons/l10n_do/__init__.py
2015-01-23 11:11:27 +01:00
Frédéric van der Essen aab3d9f4b4 [FIX] point_of_sale: use the same rounding sequence as the backend
Conflicts:
	addons/point_of_sale/static/src/js/models.js
2014-12-26 17:52:06 +01:00
Frédéric van der Essen 4647f896a4 [FIX] point_of_sale: prevent negative bank payments 2014-12-26 17:50:07 +01:00
Frédéric Van der Essen 681c33aa11 Merge pull request #4027 from akretion/8.0-fix-4026-discount-barcode
[FIX] Fixes #4026 on discount barcode in POS
2014-12-24 16:33:58 +01:00
Frédéric van der Essen c8000df710 [IMP] point_of_sale: add support for taxes included in base amount. 2014-12-18 14:59:18 +01:00
Frédéric van der Essen 34b539494e [IMP] point_of_sale: access taxes via id for performance reasons
[IMP] point_of_sale: do not recompute taxes_by_id every time
2014-12-18 14:58:57 +01:00
Frédéric van der Essen 71ebd81229 [FIX] point_of_sale: (do not forward-port!) allow horizontal scrolling of the order list 2014-12-17 15:19:31 +01:00
Frédéric van der Essen bb913d0a8f [FIX] point_of_sale: the search in product or partners could crash if there were a number followed by a colon 2014-12-11 15:42:51 +01:00
Alexis de Lattre 80d4be0af9 [FIX] Fixes #4026 on discount barcode in POS 2014-12-03 22:14:18 +01:00
Frédéric van der Essen d700c78c56 [FIX] point_of_sale: correctly handle various xmlrpc errors that appear in offline mode 2014-12-01 15:46:29 +01:00
Mario Arias Badila d349723271 [point_of_sale] Domain functions to literals
Replaced domain functions with literals where there are only constants
2014-11-26 08:32:33 -06:00
Mario Arias Badila 9db0face13 POS is loading all partners, not only customers
Hi,

Adding domain to res.partner model, so POS only loads "customers"
2014-11-21 09:20:45 -06:00