Skip to content

Commit

Permalink
[IMP] use write or direct assignation instead of update where susitable
Browse files Browse the repository at this point in the history
  • Loading branch information
jjscarafia committed Oct 25, 2018
1 parent b39e50d commit 9750bf5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
8 changes: 2 additions & 6 deletions account_multicompany_ux/models/product_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ def _compute_properties(self):
company_properties = company_property.with_context(
active_model=self._name,
active_id=rec.id)
values = {}
for newfield, oldfield in property_fields.items():
values.update({
newfield: company_properties.with_context(
property_field=oldfield)._get_companies()
})
rec.update(values)
rec[newfield] = company_properties.with_context(
property_field=oldfield)._get_companies()

@api.multi
def action_company_properties(self):
Expand Down
8 changes: 2 additions & 6 deletions account_multicompany_ux/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ def _compute_properties(self):
company_properties = company_property.with_context(
active_model='product.template',
active_id=rec.product_tmpl_id.id)
values = {}
for newfield, oldfield in property_fields.items():
values.update({
newfield: company_properties.with_context(
property_field=oldfield)._get_companies()
})
rec.update(values)
rec[newfield] = company_properties.with_context(
property_field=oldfield)._get_companies()

@api.multi
def action_company_properties(self):
Expand Down
8 changes: 2 additions & 6 deletions account_multicompany_ux/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,9 @@ def _compute_properties(self):
for rec in self:
company_properties = self.env['res.company.property'].with_context(
active_model=self._name, active_id=rec.id)
values = {}
for newfield, oldfield in property_fields.items():
values.update({
newfield: company_properties.with_context(
property_field=oldfield)._get_companies()
})
rec.update(values)
rec[newfield] = company_properties.with_context(
property_field=oldfield)._get_companies()

@api.multi
def action_company_properties(self):
Expand Down

0 comments on commit 9750bf5

Please sign in to comment.