Technical mailing list archives


Re: Configuration settings - creates a new record every time.

- 26 سبتمبر, 2014 09:13:31
Found a solution.
Just add res_id to action definition and it will always open specified res_id.
The only I don't understand why this does not when returned from code.

        <record id="asterisk_server_settings" model="ir.actions.act_window">
            <field name="name">Asterisk Dialer</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">asterisk.server.settings</field>
            <field name="view_id" ref="view_asterisk_server_settings"/>
            <field name='view_type'>form</field>
            <field name="view_mode">form</field>
            <field name="target">inline</field>
<field name="res_id">1</field>

2014-09-26 4:25 GMT+04:00 Maxim Litnitskiy <>:
I left playing with res.config.settings seems it's for module configurations.

What I am trying to do now is just to have one record of confoguration model.
For that I created a form view and action with with_mode=form.
The only thing I am trying to get is to open it with res_id = 1.
But I cannot do it.
When I click in menuitem my action always opens in create mode.
I am trying to overwrite fields_view_get, but no use.

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
        res = super(server_settings, self).fields_view_get(cr, uid, view_type=view_type, view_id=view_id, context=context, toolbar=toolbar, submenu=submenu)
        print res
        res['res_id'] = 1
        return res

Can anyone help?