This question has been flagged

Hi folks,

So, I have an entity in my system called "Calendar Events". This entity has a field called "case_id" defined as follows:

'case_id': fields.many2one('jcrm.case','Linked Case'),

From my case entity, I have a button on the form view that takes the user from cases to events and tries to filter the events by the case_id.

Search view definition for case_id on event search screen (verified working when manually typing in a case):

<field name="case_id" filter_domain="[('case_id','ilike',self)]" />

Definition of the actions attached to my button:

<record id="action_case_calendar_event_list" model="ir.actions.act_window">
        <field name="name">Case Events</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">jcrm.calendar.event</field>
        <field name="src_model">jcrm.case</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{'search_default_case_id': active_id}</field>
        <field name="domain">[]</field>
        <field name="search_view_id" ref="jcrm_calendar.view_jcrm_calendar_event_search"/>
    </record>

It is the context which is "broken" here. In version 6, the 'search_default_case_id': active_id, would basically automatically fill in the case_id search field with the ID of the case I am coming from. In version 7, this doesn't work.

I wondered if the problem was the "active_id" bit so I hard coded an ID, that didn't work.

I wondered if the terminology didn't work anymore, so I tried a different field type ('search_default_name': 'Alex') and that did work, so it seems my terminology is correct.

So, I was wondering if anyone could help me out?

Avatar
Discard
Best Answer

maybe you have the same problem like i had:

https://accounts.openerp.com/forum/Help-1/question/8598/

look my answer, maybe that is the solution for you too.

Avatar
Discard
Author

Hi there, thanks for your response but unfortunately it looks like the fix either hasn't been released or doesn't work as I am still experiencing the issue despite updating my server and web code. Thanks for pointing me in the right direction though.