Source code for openerp_proxy.experimental.relations
"""
This module contains functions and classes that could be used to get
information abour record relations
"""
from ..ext import sugar # noqa
from ..orm.object import Object
from ..orm.record import (Record, RecordList)
[docs]class RelationsObject(Object):
[docs]class RecordRelations(Record):
[docs] def get_rel_data_domain(self, field):
if field.ttype == 'many2one':
return [(field.name, '=', self.id)]
elif field.ttype in ('one2many', 'many2many'):
return [(field.name, 'in', [self.id])]
else:
return []
[docs]class RecordListRelations(RecordList):