Commit Graph
10 Commits
Author SHA1 Message Date
Ivan Yelizariev 59132ce996 [FIX] pos_cache: load products by batches
pos_cache is used to speed up opening POS in databases with large number of
products. In some cases it's still not enough and thousands of records cannot be
cached in a single request, because reading information may take more time than
maximum allowed.

As a workaround, this commit adds posibility to split request into few small
requests. To activate the feature set system parameter
``pos_cache.limit_products_per_request`` to appropriate value depending on your
server capacity.

---

opw-2439347

closes odoo/odoo#66995

X-original-commit: fe7718d02f7539959616b0e6f56d4354c768339b
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-03-01 11:11:24 +00:00
Adrien Widart c8515a53b0 [FIX] pos_cache: add pos to product
When adding a product to the order, the total will be updated but the
orderline will not be displayed

To reproduce the error:
1. Go to Point Of Sale
2. New Session
3. Click on a product so it will be added to the order

Err: The order's total is correctly updated but the line is not
displayed.

When displaying an orderline, the system wants to use the product's unit
name (`t-esc="props.line.get_unit().name"`). To do so, it uses one
specific variable of the current product, `pos`:
https://github.com/odoo/odoo/blob/abff1ca94bcc829250b63fd9677890988b796819/addons/point_of_sale/static/src/js/models.js#L1518-L1528
When using the standard Point of Sale, this variable is added on products
loading (L446) :
https://github.com/odoo/odoo/blob/abff1ca94bcc829250b63fd9677890988b796819/addons/point_of_sale/static/src/js/models.js#L438-L448
However, this variable is not set when using the pos_cache module.

OPW-2431221

closes odoo/odoo#64413

X-original-commit: cc2bd6717df379e87c9dfc485aa51f8dd33f6b76
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-01-12 14:14:11 +00:00
Ivan Yelizariev 4938c84739 [FIX] pos_cache: make it compatible with onboarding tool
STEPS:
* install pos_cache in clean database without demo
* open pos
* click OK on popup "Would you like to load demo data"

closes odoo/odoo#63103

Before: error, products are not loaded even after refreshing
After: no errors, products are loaded
X-original-commit: e669ea8a6a79fdf7e309b3191c9648c60179d195
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-12-09 15:12:53 +00:00
Joseph Caburnay e773761d10 [REF] pos_cache: migration to OWL framework 2020-05-12 12:48:58 +00:00
Pierre Masereel b9889e081e [FIX] pos_cache: eval domain before sending it to server
Since changes made on 'product.product' model in rev: 30e4d89a62
the domain is not represented as a string, but as a function, and that
leads to error as the javascript function is sent to the server instead
of a string representing a domain.

So we check the type of domain to see if we have to evaluate a function
or send the domain as a string

closes odoo/odoo#34453

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-06-28 14:05:58 +00:00
Victor Tabuenca Calvo c3ce1d4f13 [FIX] pos_cache: Adapt JS code to ac89783d2f.
Otherwise, when rendering the 'Product' template it crashes when calling
the 'get_price' method.

Indeed, we need to add products as a Product model instead of as a plain
JS object.
2017-11-22 15:25:01 -08:00
Géry Debongnie 2106e3dd2e [REF] web, *: simplify our RPC system (in JS)
The RPC system was not completely satisfactory, we decided to prepare
the future and do it properly.  This commit introduces the new rpc
system, which replace the previous new one.  We now simply have a
method, this._rpc, which takes a dictionary of parameters.  The idea is
that depending on the parameters, it is able to add correct default
value when necessary.

For situations where we don't have the this._rpc method, we can use the
rpc.query method, which takes the same arguments, but directly calls
ajax.rpc instead of triggering up some events.
2017-04-11 19:44:38 +02:00
Géry Debongnie 86a87aa8b0 [REF] *: use _rpc method for all rpcs
The _rpc method is now the preferred method to do a rpc, so we need to
update all calls.
2017-04-11 19:44:38 +02:00
Géry Debongnie e574027056 [REF] web,*: remove 'web.model' and 'web.dataModel
Use this.rpc instead of Model object, with web.ajax if necessary.

nb: EventDispatcherMixin include now the custom_events managment instead
of widget
2017-04-11 19:44:38 +02:00
Joren Van Onder 97b0723722 [ADD] pos_cache: add pos_cache ported to v9 from odoo-extra
Originally written by Nicolas Seinlet <nse@odoo.com>. Provides
pos.config with a product.product cache.

This adds a ported and refactored pos_cache from odoo-extra:

- Adapt to changes in web and point_of_sale since 8.0
- Refactor the load_server_data function, so it isn't copy pasted but
  cleanly patched into the load_server_data super.
- Make the cron inactive by default.
- Also remove retrying the write 5 times, when it fails we'll just have
  to wait until the cron triggers again (an hour from then).
- Store the product.product fields and domain on pos_cache. When cache
  is requested from the pos with a different field or domain it'll
  automatically recompute. Necessary for when someone would install a
  module that modifies these things in the pos after a cache has been
  generated.
- Have multiple caches per pos_config per user
- Make the module adhere to the Odoo Coding Guidelines.
2015-09-25 12:47:29 +02:00