diff options
| author | wan <wan@odoo.com> | 2019-09-02 09:27:49 +0000 |
|---|---|---|
| committer | qdp-odoo <qdp@odoo.com> | 2019-09-09 14:22:27 +0000 |
| commit | 2ad8d8c9645a9ba0408c9e9b19dedd192b417645 (patch) | |
| tree | 1eb3fd67aa0a758f147d0ba1e0d7ec3efd6adefd /addons/web/static/src | |
| parent | 4ba77c52f5d3287e7233eca604f2a086e3f29f7d (diff) | |
[REF] web: add public API to open the selectCreateDialog of a many2many
Part of task 2005972
It is used in account_asset, when the o2m field is hidden and at the end of the form, but we need the user to see it at the beginning of the form
closes odoo/odoo#36315
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index c539a3ce12d..93863c2f619 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1768,21 +1768,13 @@ var FieldMany2Many = FieldX2Many.extend({ supportedFieldTypes: ['many2many'], //-------------------------------------------------------------------------- - // Handlers + // Public //-------------------------------------------------------------------------- - /** - * Opens a SelectCreateDialog. - * - * @override - * @private - * @param {OdooEvent|MouseEvent} ev this event comes either from the 'Add - * record' link in the list editable renderer, or from the 'Create' button - * in the kanban view + * Opens a SelectCreateDialog */ - _onAddRecord: function (ev) { + onAddRecordOpenDialog: function () { var self = this; - ev.stopPropagation(); var domain = this.record.getDomain({fieldName: this.name}); new dialogs.SelectCreateDialog(this, { @@ -1808,6 +1800,25 @@ var FieldMany2Many = FieldX2Many.extend({ } }).open(); }, + + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + + /** + * Opens a SelectCreateDialog. + * + * @override + * @private + * @param {OdooEvent|MouseEvent} ev this event comes either from the 'Add + * record' link in the list editable renderer, or from the 'Create' button + * in the kanban view + */ + _onAddRecord: function (ev) { + ev.stopPropagation(); + this.onAddRecordOpenDialog(); + }, + /** * Intercepts the 'open_record' event to edit its data and lets it bubble up * to the form view. |
