[FIX] website: auto enable multi website when creating a second website
Before this commit, you need to check manually multi website. And demo data create 2 websites by default, but don't check it.
This commit is contained in:
@@ -125,6 +125,12 @@ class Website(models.Model):
|
||||
|
||||
res = super(Website, self).create(vals)
|
||||
res._bootstrap_homepage()
|
||||
|
||||
if not self.env.user.has_group('website.group_multi_website') and self.search_count([]) > 1:
|
||||
all_user_groups = 'base.group_portal,base.group_user,base.group_public'
|
||||
groups = self.env['res.groups'].concat(*(self.env.ref(it) for it in all_user_groups.split(',')))
|
||||
groups.write({'implied_ids': [(4, self.env.ref('website.group_multi_website').id)]})
|
||||
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Website</h2>
|
||||
<h2>Website <button name="action_website_create_new" type="object" string="New" class="ml-2 btn btn-link" icon="fa-plus" groups="!website.group_multi_website"/></h2>
|
||||
<div class="row mt16 o_settings_container" id="website_settings">
|
||||
<div class="col-12 o_setting_box" id="website_action_setting">
|
||||
<button name="website_go_to" type="object" string="Go to Website" class="btn btn-primary" icon="fa-globe"/>
|
||||
|
||||
Reference in New Issue
Block a user