This question has been flagged
1 Reply
2355 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