Phong Vy
Phong Vy

Reputation: 401

How to change context of model "ir.filters" in odoo

In parent module I have something likes :

<record id="filter_hr_timesheet_report_internal_timesheets" model="ir.filters">
    <field name="name">Internal Timesheet</field>
    <field name="model_id">hr.timesheet.report</field>
    <field name="domain">[('state','=','done'), ('date','&lt;=', time.strftime('%Y-%m-%d')),('date','&gt;=',time.strftime('%Y-%m-01'))]</field>
    <field name="user_id" eval="False"/>
    <field name="context">{'group_by': ['user_id'], 'col_group_by': ['department_id'], 'measures': ['time']}</field>
</record>

and I want to change group_by in context field but can't find any document for model "ir.filters"

Update:

I resolved it by myself by :

<record id="hr_timesheet_sheet.filter_hr_timesheet_report_internal_timesheets" model="ir.filters">
        <field name="context">{'group_by': ['employee_id'], 'col_group_by': ['department_id'], 'measures': ['time']}</field>
    </record>

Upvotes: 1

Views: 743

Answers (1)

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11143

We can access record id with module name and we can update any attribute as per our requirement.

For example:

module_name.xml_record_id

Try with following code:

<record id="hr_timesheet_sheet.filter_hr_timesheet_report_internal_timesheets" position="attributes">
    <attribute name="context">NEW CONTEXT WILL COME HERE</attribute>
</record>

Upvotes: 1

Related Questions