0
votes

In Odoo, I can open a record in form view by using a button to trigger an action on the data model:

@openerp.api.multi
def open_record_in_form_view(self):
    return {
        'type': 'ir.actions.act_window',
        'res_model': 'model.name',
        'views': ((False, 'form'), (False, 'tree')),
        'res_id': RECORD_ID,
        'domain': [('field', '=', 'value')],
    }

The record opens correctly, except that the pager is disabled. The curious bit is that when I toggle from form view to list view, the correct set of records is shown (as per the specified domain), and then when I toggle back from list view to form view, the pager is enabled, and I can page through the records in the domain.

How do I enable the pager when first opening form view? I want to page through a set of records a in domain, but in form view, not in list view view.

1
Have you tried adding view_mode and view_type? ... 'view_mode': 'tree', 'view_type': 'tree', ...Ivica
Thanks for the suggestion! Yes, I tried setting view_mode and view_type, and I also tried setting views. As I understand it, Odoo initializes the value for the views settings from the view_mode and view_type settings. You can read a (very) little bit about that here: odoo.com/documentation/8.0/reference/actions.html Still at a loss for how to do this.Monica For CEO

1 Answers

0
votes
def open_record_in_form_view(self):
return {
    'name': 'name of Action',
    'type': 'ir.actions.act_window',
    'res_model': 'model.name',
    'view_mode': 'tree,form',
    'domain': [('field', '=', 'value')],
}

you need to add 'name' and 'view_mode' fields ...