summaryrefslogtreecommitdiff
path: root/addons/pos_cache
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-07-05 16:14:48 +0200
committerChristophe Simonis <chs@odoo.com>2019-07-05 16:14:48 +0200
commit66bb578ac9f0cc260a5b7f859fc0bb4fcfab6e25 (patch)
tree57b147168f7118374f0f5b4ba46f4c9d75220df2 /addons/pos_cache
parent201c5b5878f13c34cb7a9edb3c3296fc9a1944fe (diff)
parentbe5e8fdab800ff1fd9e953ec64801f96bcc3dac5 (diff)
[MERGE] forward port branch saas-12.2 up to be5e8fdab80
Diffstat (limited to 'addons/pos_cache')
-rw-r--r--addons/pos_cache/static/src/js/pos_cache.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/addons/pos_cache/static/src/js/pos_cache.js b/addons/pos_cache/static/src/js/pos_cache.js
index 6a26143cc6e..1b59761bc26 100644
--- a/addons/pos_cache/static/src/js/pos_cache.js
+++ b/addons/pos_cache/static/src/js/pos_cache.js
@@ -15,22 +15,21 @@ models.PosModel = models.PosModel.extend({
return model.model === "product.product";
});
- // Give both the fields and domain to pos_cache in the
- // backend. This way we don't have to hardcode these
- // values in the backend and they automatically stay in
- // sync with whatever is defined (and maybe extended by
- // other modules) in js.
- var product_model = this.models[product_index];
- var product_fields = product_model.fields;
- var product_domain = product_model.domain;
+ var product_model = self.models[product_index];
// We don't want to load product.product the normal
// uncached way, so get rid of it.
if (product_index !== -1) {
this.models.splice(product_index, 1);
}
-
return posmodel_super.load_server_data.apply(this, arguments).then(function () {
+ // Give both the fields and domain to pos_cache in the
+ // backend. This way we don't have to hardcode these
+ // values in the backend and they automatically stay in
+ // sync with whatever is defined (and maybe extended by
+ // other modules) in js.
+ var product_fields = typeof product_model.fields === 'function' ? product_model.fields(self) : product_model.fields;
+ var product_domain = typeof product_model.domain === 'function' ? product_model.domain(self) : product_model.domain;
var records = rpc.query({
model: 'pos.config',
method: 'get_products_from_cache',