Browse Source

Remove api.one decorator to get_underlying_object method and mark it as private

pull/132/head
Antonio Espinosa 9 years ago
parent
commit
3c006db8e3
  1. 10
      partner_relations/model/res_partner_relation_all.py

10
partner_relations/model/res_partner_relation_all.py

@ -138,8 +138,7 @@ class ResPartnerRelationAll(models.AbstractModel):
return super(ResPartnerRelationAll, self)._auto_init(
cr, context=context)
@api.one
def get_underlying_object(self):
def _get_underlying_object(self):
"""Get the record on which this record is overlaid"""
return self.env[self._overlays].browse(self.id / PADDING)
@ -176,8 +175,7 @@ class ResPartnerRelationAll(models.AbstractModel):
@api.one
def write(self, vals):
"""divert non-problematic writes to underlying table"""
underlying_objs = self.get_underlying_object()
underlying_objs = underlying_objs and underlying_objs[0]
underlying_objs = self._get_underlying_object()
vals = {
key: val
for key, val in vals.iteritems()
@ -210,6 +208,4 @@ class ResPartnerRelationAll(models.AbstractModel):
@api.one
def unlink(self):
"""divert non-problematic creates to underlying table"""
underlying_objs = self.get_underlying_object()
underlying_objs = underlying_objs and underlying_objs[0]
return underlying_objs.unlink()
return self._get_underlying_object().unlink()
Loading…
Cancel
Save