|
|
@ -15,11 +15,12 @@ class ResPartner(models.Model): |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def browse(self, arg=None, prefetch=None): |
|
|
|
for tab in self._get_tabs(): |
|
|
|
fieldname = tab.get_fieldname() |
|
|
|
if fieldname not in self._fields: |
|
|
|
# Check this for performance reasons. |
|
|
|
self.add_field(tab) |
|
|
|
if "update_relation_tab" in self.env.context: |
|
|
|
for tab in self._get_tabs(): |
|
|
|
fieldname = tab.get_fieldname() |
|
|
|
if fieldname not in self._fields: |
|
|
|
# Check this for performance reasons. |
|
|
|
self.add_field(tab) |
|
|
|
return super(ResPartner, self).browse(arg=arg, prefetch=prefetch) |
|
|
|
|
|
|
|
@api.model |
|
|
@ -71,10 +72,11 @@ class ResPartner(models.Model): |
|
|
|
@api.depends('is_company', 'category_id') |
|
|
|
def _compute_tabs_visibility(self): |
|
|
|
"""Compute for all tabs wether they should be visible.""" |
|
|
|
for tab in self._get_tabs(): # get all tabs |
|
|
|
for this in self: |
|
|
|
this[tab.get_visible_fieldname()] = \ |
|
|
|
tab.compute_visibility(this) |
|
|
|
if "update_relation_tab" in self.env.context: |
|
|
|
for tab in self._get_tabs(): # get all tabs |
|
|
|
for this in self: |
|
|
|
this[tab.get_visible_fieldname()] = \ |
|
|
|
tab.compute_visibility(this) |
|
|
|
|
|
|
|
def _get_tabs(self): |
|
|
|
tab_model = self.env['res.partner.tab'] |
|
|
|