It seems like you're trying to pass the result of the get_current_user_parent_partner_id method as a value for the context variable in your XML code. However, the way you're trying to do it is not correct. Here's the corrected version:
List Of Claims
claim
{
'default_parent_partner_id': get_current_user_parent_partner_id()
}
[('create_uid.partner_id.parent_id.id', '=', default_parent_partner_id)]
In the above XML code:
- We're using the context field to pass values to the context dictionary.
- We're setting the key 'default_parent_partner_id' in the context dictionary to the result of the get_current_user_parent_partner_id method.
- In the domain field, we're using default_parent_partner_id to filter claims based on the current user's parent partner ID.
Make sure your get_current_user_parent_partner_id method is properly defined in your Python code, and the method should be accessible from the XML context. With this setup, when you open the list of claims, it will filter the claims based on the parent partner ID of the current user.
This is the Full code
@api.model
def get_current_user_parent_partner_id(self):
current_user = self.env.user
parent_partner_id = current_user.partner_id.parent_id.id
return parent_partner_id
- XMl code that I Write it
<record id="ca_claim_action" model="ir.actions.act_window">
<field name= "name">I List Of Claims</field>
<field name= "res_model">claim</field>
<{"parent_partner_id": get_current_user_parent_partner_id()}</field>
<field name="domain">[('create_uid.partner_id.parent_id.id', '=', context.get('parent_partner_id'))]</field> </record>