summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-18 11:32:27 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-18 11:32:27 +0200
commit2f037a13ca3a3f4e570f19b11af3e75acb9618d3 (patch)
treedcae51fe39b1c76f98851b4200c04722c7509463
parent91ca846447628084f5a089e986319ef18581ddf2 (diff)
parentcf163d19eefb8049c8bbd443cd9d1f3260cf3774 (diff)
[MERGE] forward port branch 9.0 up to cf163d19eef
-rw-r--r--addons/board/static/src/js/dashboard.js4
-rw-r--r--addons/web/controllers/main.py20
-rw-r--r--odoo/addons/base/i18n/base.pot12
-rw-r--r--odoo/addons/base/ir/ir_model.py7
4 files changed, 33 insertions, 10 deletions
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
@@ -11467,6 +11467,18 @@ 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
#: model:ir.ui.view,arch_db:base.edit_menu_access
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: