summaryrefslogtreecommitdiff
path: root/addons/web/controllers
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 /addons/web/controllers
parent91ca846447628084f5a089e986319ef18581ddf2 (diff)
parentcf163d19eefb8049c8bbd443cd9d1f3260cf3774 (diff)
[MERGE] forward port branch 9.0 up to cf163d19eef
Diffstat (limited to 'addons/web/controllers')
-rw-r--r--addons/web/controllers/main.py20
1 files changed, 12 insertions, 8 deletions
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):