[MERGE] forward port branch 9.0 up to cf163d19ee

This commit is contained in:
Christophe Simonis
2018-04-18 11:32:27 +02:00
4 changed files with 33 additions and 10 deletions
+2 -2
View File
@@ -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();
+12 -8
View File
@@ -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):
+12
View File
@@ -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
+7
View File
@@ -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: