From c4ea35d938246a15d71bc77d36ca4c82b67f61f4 Mon Sep 17 00:00:00 2001 From: Siddharth Bhalgami Date: Thu, 11 Jan 2018 16:42:55 +0530 Subject: [PATCH] [ADD] website_menus form view & set default website in newly created menus --- addons/website/models/website.py | 5 +++-- addons/website/views/website_views.xml | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 971beb20..ca60c906 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -904,8 +904,9 @@ class Menu(models.Model): page_id = fields.Many2one('website.page', 'Related Page') new_window = fields.Boolean('New Window') sequence = fields.Integer(default=_default_sequence) - website_id = fields.Many2one('website', 'Website') # TODO: support multiwebsite once done for ir.ui.views - parent_id = fields.Many2one('website.menu', 'Parent Menu', index=True, ondelete="cascade") + website_id = fields.Many2one('website', 'Website', required=True, + default=lambda self: self.env.ref('website.default_website')) # TODO: support multiwebsite once done for ir.ui.views + parent_id = fields.Many2one('website.menu', 'Parent Menu', index=True, ondelete="cascade", domain="[('website_id','=', website_id)]") child_id = fields.One2many('website.menu', 'parent_id', string='Child Menus') parent_left = fields.Integer('Parent Left', index=True) parent_right = fields.Integer('Parent Rigth', index=True) diff --git a/addons/website/views/website_views.xml b/addons/website/views/website_views.xml index 1e4ba71f..da41c716 100644 --- a/addons/website/views/website_views.xml +++ b/addons/website/views/website_views.xml @@ -169,10 +169,31 @@ Website Menu website.menu - list + form + tree,form {'search_default_my_websites':1} + + website.menu.form + website.menu + +
+ + + + + + + + + + + +
+
+
+ website.menu.tree website.menu