Hi
how we can show the selected fields in one2many relation per user ,
in another model using many2one relation !!
i have module A it is table in res.user per user i need to show the fields in another model calss B
as the below
___________________________________________________________________________________________________________________
Class res_user_inherit(models.Model):
_inherit = 'res.users'
user_entity_id = fields.One2many('model.A','entity_id')
____________________________________________________________________________________________________________________
class' model_A(models.Model):
_name = ''model.A''
entity_id = fields.Many2one('res.users')
default_entity = fields.Boolean(string='default entity')
______________________________________________________________________________________________________________________
class model_B(models.Model):
_name = 'model.B'
user_entity = fields.Many2one ('model.A','entity_id',default = lambda self: self.env['model.A'].search([('default_entity', '=', 'True')], limit=1)
___________________________________________________________________________________________________________________
i have tried with no luck
@api.model
def _getentity(self):
return [('user_entity', '=', self.env['res.users'].search([('user_entity_id', '=', self._uid.entity_id)]))]