I want to filter name_id
field by domain. Was trying:
name_id = fields.Many2one('my.model.line', string='Product', domain=[('purchase_request_id', '=', model_id)])
but then I got an error:
File "/opt/odoo/openerp/fields.py", line 343, in __getattr__
return self._attrs[name]
File "/opt/odoo/openerp/fields.py", line 343, in __getattr__
return self._attrs[name]
File "/opt/odoo/openerp/fields.py", line 343, in __getattr__
return self._attrs[name]
File "/opt/odoo/openerp/fields.py", line 343, in __getattr__
return self._attrs[name]
File "/opt/odoo/openerp/fields.py", line 343, in __getattr__
return self._attrs[name]
RuntimeError: maximum recursion depth exceeded
my_model.xml
<record model="ir.ui.view" id="view_my_model_form">
<field name="name">my.model.form</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<form string="My Model">
<header>
<field name="my_model_line">
<tree>
field name="name"/>
</tree>
</field>
<notebook>
<page>
<field name="supply_conditions_status">
<tree string="My model Lines">
<field name="name_id"/>
</tree>
Models:
class SupplyConditions(models.Model):
_name = 'supply.conditions'
name_id = fields.Many2one('my.model.line', string='Product')
model_id = fields.Many2one('my.model')
class MyModelLine(models.Model):
_name = 'my.model.line'
name = fields.Char('Name')
my_model_id = fields.Many2one('my.model')
class MyModel(models.Model):
_name = 'my.model'
title = fields.Char('Title')
my_model_line = fields.One2many('my.model.line', 'my_model_id')
supply_conditions_status = fields.One2many('supply.conditions', 'model_id')
UPDATE:
I mean: domain=[('my_model_id', '=', model_id)])