I'm adding a spouse line to the res_partner object like
class ResPartner(models.Model):
_inherit = 'res.partner'
spouse_ids = fields.One2many('res.partner.spouse.line', 'partner_id', string="Spouse(s)")
mother_id = fields.Many2one('res.partner', string='Mother')
And corresponding co-model is
class ResPartnerSpouseLine(models.Model):
_name = 'res.partner.spouse.line'
partner_id = fields.Many2one('res.partner')
life_partner_id = fields.Many2one('res.partner', string="Life Partner")
Now I want to filter out the spouse_ids for mother_id. For that in the xml file I tried the following
<field name='mother_id'
domain="[('id', '!=', id), ('is_company', '!=', True), ('id', 'not in', spouse_ids.life_partner_id)]"/>
But I get the error
Error: AttributeError: object has no attribute 'life_partner_id'
Again I don't want the mother_id to be shown in the spouse_ids. So I tried to add a domain for spouse_ids as
<field name='spouse_ids'>
<tree editable="bottom" default_order="spouse_order" >
<field name="partner_id" invisible="1"/>
<field name="life_partner_id" domain="[('id', 'not in', partner_id.mother_id)]"/>
</tree>
</field>
But I get the error
Error: AttributeError: object has no attribute 'mother_id'
How to properly give domain and filter out those ids. Thanks in advance
Hello,
I think your value is not store in DB so set store= True after check.