summaryrefslogtreecommitdiff
path: root/addons/pos_cache/static/src/js
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-07-15 07:07:48 +0000
committerMartin Trigaux <mat@odoo.com>2019-07-15 08:12:26 +0000
commitfd15ca19183a765e1307c4d197bf0dda30b73ab7 (patch)
tree896042073ebc752e8bcf535f21696320c69bbe13 /addons/pos_cache/static/src/js
parent6b8a0beda65dce688ecd0ee34828097b67a13dab (diff)
parent1f5a4649a67908ecb6acfec37673c8149de0471f (diff)
[MERGE] Forward port of saas-12.4 to master up to 1f5a4649a67908
closes odoo/odoo#34850 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/pos_cache/static/src/js')
-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',