Skip to Content
Menu
This question has been flagged
1 Reply
2549 Views

i have odoo 12 

i am creating a custom module and have a field 'assigned_to'

*.py

assigned_to = fields.Many2one('res.users', string='Assigned To')

i need to filter assigned_user with logged user

*.xml

<record id="bug_search_view" model="ir.ui.view">
<field name="name">test.Search.View</field>
<field name="model">test.test</field>
<field name="arch" type="xml">
<search string="Search Bugs">
<field name="project_name" 
                   filter_domain="['|',('title_name', 'ilike',self), ('project_name', 'ilike', self)]"/>
<field name="title_name"/>
<field name="project_name"/>
<separator/>
00
<filter string="Assigned to Me" name="assigned_to" domain="[('user_id', '=', uid)]" help="assigned to me"/>
</search>
</field>
</record>
I got an error
 raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))
ValueError: Invalid field 'user_id' in leaf "<osv.ExtendedLeaf: ('user_id', '=', 2) on bugg__tracker_bugg__tracker (ctx: )>"
please help me to fix this issue.....
Avatar
Discard
thanks, it is working

On Tue, Oct 15, 2019 at 1:44 PM Niyas Raphy <niyasraphyk@gmail.com> wrote:

A new question Filter records: field assigned_to with logged user on Help has been posted. Click here to access the question :

See question

Sent by Odoo S.A. using Odoo.

Best Answer

Hi,

Update the domain like this:  domain="[('assigned_to', '=', uid)]"

User field name seems to be assigned_to, not user_id.

Thanks

Avatar
Discard