Permalink
Browse files

🚑 give public user access to all websites

  • Loading branch information...
trojikman committed Jan 27, 2019
1 parent df79343 commit 9948461d115cc609181fb2029a0d39a958a54c92
Showing with 8 additions and 3 deletions.
  1. +8 −3 web_website/models/res_users.py
@@ -34,14 +34,19 @@ def _get_company(self):
return super(ResUsers, self)._get_company()

@api.model
def _search_company_websites(self, company_id):
def _search_company_websites(self, company_ids):
return self.env['website'].search([
('company_id', 'in', [False] + [company_id])
('company_id', 'in', [False] + company_ids)
])

@api.onchange('company_ids')
def _compute_backend_website_ids(self):
public_user = self.env.ref('base.public_user')
for r in self:
websites = self._search_company_websites(r.company_id.id)
if public_user.id == r.id:
websites = self._search_company_websites(r.company_ids.ids)
else:
websites = self._search_company_websites([r.company_id.id])
r.backend_website_ids = websites
r.backend_websites_count = len(websites)

0 comments on commit 9948461

Please sign in to comment.