summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/field_registry.js
diff options
context:
space:
mode:
authorMichael Mattiello (mcm) <mcm@odoo.com>2020-03-27 10:56:05 +0000
committerMichael Mattiello (mcm) <mcm@odoo.com>2020-03-31 07:11:01 +0000
commit9324282b0118e311382ee9a57cd10ef3f02d1dbb (patch)
treeb4663f82c2e837ba23f70b562b6dfd743b96167f /addons/web/static/src/js/fields/field_registry.js
parent91c7e574ed4a08a4d9998a7f5f481b99ae6154ee (diff)
[REF] web,*: add new field registry for components
* account This commit adds a new field registry for component fields. This field registry is used to only register the new field components and the other one should register the legacy fields. Those two registries will be used together while all legacy fields are not converted to owl component. As the legacy registry now throws an error when adding a component field the existing component fields (account.ShowGroupedList and account.ShowResequenceRenderer) are moved into the new registry. This commit also refactors some field managers (form renderer, list editable renderer, calendar popover) to use the new registry and thus support the component fields. task id: 2193996
Diffstat (limited to 'addons/web/static/src/js/fields/field_registry.js')
-rw-r--r--addons/web/static/src/js/fields/field_registry.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/field_registry.js b/addons/web/static/src/js/fields/field_registry.js
index 49f1f678304..b8b3fe61452 100644
--- a/addons/web/static/src/js/fields/field_registry.js
+++ b/addons/web/static/src/js/fields/field_registry.js
@@ -3,7 +3,16 @@ odoo.define('web.field_registry', function (require) {
var Registry = require('web.Registry');
-return new Registry();
+var FieldRegistry = Registry.extend({
+ add: function (key, value, score) {
+ if (value.prototype instanceof owl.Component) {
+ throw new Error("This registry should not contain any Component. Use 'web.field_registry_owl' instead.");
+ }
+ return this._super(...arguments);
+ },
+});
+
+return new FieldRegistry();
});
odoo.define('web._field_registry', function (require) {