Help

6

Shall we sort out contacts by sales team through domain_force in V10?

Avatar
Annadurai

I have created a domain_force  to sort out contacts through sale_teams or sales_person.

in preference, I set sales_team "team_id".  if the user salesteam is "direct sales"  then the contacts having same sales_team " directsales" then it only show corresponding contacts. 


 <odoo> <data noupdate="0"> <record model="ir.rule" id="ir_my_custom_rule"> <field name="name">salesteamaccess</field> <field name="model_id" ref="base.model_res_partner"/>  <field name="domain_force">['|','|',('user_id','=',user.id),('user_id','=',False),('team_id','=', [user.team_id])]</field>  </record> </data> </odoo>

but this doesnt work well as per need. If I logged in different user then it shows maximum reccurssive occured error.
Avatar
Discard
1 Answer
2
Avatar
IT Libertas
Best Answer

Hi,

please check 2 considerations:

  1. This leaf ('team_id','=', [user.team_id]) is incorrect. You compare Team ID with a list of objects. It should be either ('team_id','=', user.team_id.id) or ('team_id','in', [user.team_id.id])

  2. You apply a global rule for all user groups. It is better to overwrite some existing rule - e.g. res_partner_rule  

1 Comment
Avatar
Discard
Avatar
Annadurai
-

thank you for ur rply, I have changed those rules.

<record model="ir.rule" id="res_partner_own_documents">

<field name="name">Partner Own Documents</field>

<field name="model_id" ref="base.model_res_partner" />

<field name="domain_force">['|','|',

('user_ids','in',[user.id]),

('supplier','=',True),

'&amp;','&amp;','&amp;',

('user_id','!=',False),

('user_id','=',user.id),

('team_id','!=',False),

('team_id','=',user.team_id.id)]

</field>

<field name="groups" eval="[(6, 0, [ref('sales_team.group_sale_salesman')])]" />

</record>