summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-18 18:30:35 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-18 18:30:35 +0200
commitc309ccd7b3d7e2f4884f6e9e47a98d64ceac8ea1 (patch)
tree82deec2a691d9aee34d70aedac9b68ab75c2825c /addons/web/controllers/main.py
parente63e9857411a056538f357b1800d31c835a1647c (diff)
parentfed775bc0c2d70463206bbdddd3cce9ae8469e6a (diff)
[MERGE] forward port branch saas-11.2 up to fed775bc0c2
Diffstat (limited to 'addons/web/controllers/main.py')
-rw-r--r--addons/web/controllers/main.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index ccf7b932669..c1eb41ac13e 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -961,14 +961,17 @@ 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 Binary(http.Controller):