summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/static/src/js/ComponentRegistry.js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/point_of_sale/static/src/js/ComponentRegistry.js
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/point_of_sale/static/src/js/ComponentRegistry.js')
-rw-r--r--addons/point_of_sale/static/src/js/ComponentRegistry.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/addons/point_of_sale/static/src/js/ComponentRegistry.js b/addons/point_of_sale/static/src/js/ComponentRegistry.js
new file mode 100644
index 00000000..1e820782
--- /dev/null
+++ b/addons/point_of_sale/static/src/js/ComponentRegistry.js
@@ -0,0 +1,29 @@
+odoo.define('point_of_sale.ComponentRegistry', function(require) {
+ 'use strict';
+
+ const PosComponent = require('point_of_sale.PosComponent');
+ const ClassRegistry = require('point_of_sale.ClassRegistry');
+
+ class ComponentRegistry extends ClassRegistry {
+ freeze() {
+ super.freeze();
+ // Make sure PosComponent has the compiled classes.
+ // This way, we don't need to explicitly declare that
+ // a set of components is children of another.
+ PosComponent.components = {};
+ for (let [base, compiledClass] of this.cache.entries()) {
+ PosComponent.components[base.name] = compiledClass;
+ }
+ }
+ _recompute(base, old) {
+ const res = super._recompute(base, old);
+ if (typeof base === 'string') {
+ base = this.baseNameMap[base];
+ }
+ PosComponent.components[base.name] = res;
+ return res;
+ }
+ }
+
+ return ComponentRegistry;
+});