diff options
Diffstat (limited to 'addons/pos_cache/static/src/js/pos_cache.js')
| -rw-r--r-- | addons/pos_cache/static/src/js/pos_cache.js | 17 |
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', |
