I have 3 models:
seniat_form_86:
'line_ids':fields.one2many('seniat.form.86.lines','line_id','Tax lines',readonly=True, states={'draft':[('readonly',False)]}),
'invoice_ids':fields.one2many('account.invoice','num_import_form_id','Related invoices',readonly=True),
seniat_form_86_lines:
'line_id':fields.many2one('seniat.form.86', 'Line', required=True, ondelete='cascade'),
'line_vat_ids':fields.one2many('seniat.form_86.lines.vat','line_vat_id','Vat lines',attrs="{'readonly':[('vat_detail','=',True)],'required':[('vat_detail','=',True)]}"),
seniat_form_86_lines_vat:
'line_vat_id':fields.many2one('seniat.form.86.lines', 'Vat line', required=True, ondelete='cascade'),
'invoice_id': fields.many2one('account.invoice', 'Invoice Reference', ondelete='restrict', select=True, required=True),
...
as you can see the 3 models are "master-detail" interrelated.
I need to set a domain for seniat_form_86_lines_vat.invoice_id like this:
domain="[('id','in',line_vat_id.line_id.invoice_ids)]"
Error: NameError: name 'line_vat_id' is not defined if widget="selection" in view
I want to filter seniat_form_86_lines_vat.invoice_id with only invoices listed in seniat_form_86.invoice_ids.
Note: Server 6.0
Note 2: I also try with:
domain="[('id','in',parent.parent.invoice_ids)]"
domain="[('id','in',parent.line_id.invoice_ids)]"
domain="[('id','in',parent.invoice_ids)]"
Thanks.