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

Hello!

I added a field (consultants_ids) to the "account.analytic.account" model where i can choose some employees and give them access to  some of the analytic accounts. Now, i am trying to use a domain on the "analytic_account_id" in the "hr.expense model" in order to show only the accounts that have been connected to the user selected in the "employee_id" field.

Thank you!


PS: 

i tried 

<xpath expr="//field[@name='analytic_account_id']" position='replace'> 
     <field name="analytic_account_id" groups="base.group_user" domain="[('consultants_ids.user_id', '=', uid)]" string="Project" attrs="{'readonly':[('state','not in',['draft'])]}"/>
</xpath>

but this only shows the accounts for the logged in user.

I also tried this, but then no analytic accounts appear in the fields

<xpath expr="//field[@name='analytic_account_id']" position='replace'>
     <field name="analytic_account_id" groups="base.group_user" domain="[('consultants_ids.user_id', '=', 'employee_id)]" string="Project" attrs="{'readonly':[('state','not in',['draft'])]}"/>
</xpath>
Avatar
Discard
Best Answer

Hi, if your consultant_ids are res.partner model, then please try domain="[('consultants_ids', '=', employee_id.partner_id.id)]

Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 24
246
0
Mar 15
3028
1
Oct 24
280
2
Jul 24
471
0
May 24
239