diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index e9dec85739f..80d418de6dc 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -172,8 +172,8 @@ var DashBoard = form_common.FormWidget.extend({ board.columns.push(actions); }); var arch = QWeb.render('DashBoard.xml', board); - this.rpc('/web/view/add_custom', { - view_id: this.view.fields_view.view_id, + this.rpc('/web/view/edit_custom', { // do not forward-port > saas-15 + custom_id: this.view.fields_view.custom_view_id, // do not forward-port > saas-15 arch: arch }).then(function() { data_manager.invalidate(); diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index d99395c6032..6122b00e0ed 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -927,14 +927,18 @@ class DataSet(http.Controller): class View(http.Controller): - @http.route('/web/view/add_custom', type='json', auth="user") - def add_custom(self, view_id, arch): - CustomView = request.env['ir.ui.view.custom'] - CustomView.create({ - 'user_id': request.session.uid, - 'ref_id': view_id, - 'arch': arch - }) + @http.route('/web/view/edit_custom', type='json', auth="user") + def edit_custom(self, custom_id, arch): + """ + Edit a custom view + + :param int custom_id: the id of the edited custom view + :param str arch: the edited arch of the custom view + :returns: dict with acknowledged operation (result set to True) + """ + + custom_view = request.env['ir.ui.view.custom'].browse(custom_id) + custom_view.write({ 'arch': arch }) return {'result': True} class TreeView(View): diff --git a/odoo/addons/base/i18n/base.pot b/odoo/addons/base/i18n/base.pot index 026f23c5b98..957d4990175 100644 --- a/odoo/addons/base/i18n/base.pot +++ b/odoo/addons/base/i18n/base.pot @@ -11466,6 +11466,18 @@ msgstr "" msgid "Memos pad" msgstr "" +#. module: base +#: code:addons/base/ir/ir_model.py:382 +#, python-format +msgid "Model %s does not exist" +msgstr "" + +#. module: base +#: code:addons/base/ir/ir_model.py:383 +#, python-format +msgid "Please specify a valid model for the object relation" +msgstr "" + #. module: base #: model:ir.model.fields,field_description:base.field_ir_ui_menu_name #: model:ir.ui.view,arch_db:base.edit_menu diff --git a/odoo/addons/base/ir/ir_model.py b/odoo/addons/base/ir/ir_model.py index cbeb6f2b399..3ab7d494c1f 100644 --- a/odoo/addons/base/ir/ir_model.py +++ b/odoo/addons/base/ir/ir_model.py @@ -393,6 +393,13 @@ class IrModelFields(models.Model): def _onchange_ttype(self): self.copy = (self.ttype != 'one2many') if self.ttype == 'many2many' and self.model_id and self.relation: + if self.relation not in self.env: + return { + 'warning': { + 'title': _('Model %s does not exist') % self.relation, + 'message': _('Please specify a valid model for the object relation'), + } + } names = self._custom_many2many_names(self.model_id.model, self.relation) self.relation_table, self.column1, self.column2 = names else: