Why do we have to specify res_model in definition of act_window?

34 views
Skip to first unread message

Marko Randjelovic

unread,
Dec 6, 2016, 1:18:32 PM12/6/16
to tryton
When making Tryton module, when we define act_window object, we specity res_model. Why, since we already specify model in definition of view which is to be displayed in the act window?

For example, in trytond/modules/party/party.xml we have:

        <record model="ir.ui.view" id="party_view_tree">
            <field name="model">party.party</field>
            <field name="type">tree</field>
            <field name="name">party_tree</field>
        </record>
        <record model="ir.ui.view" id="party_view_form">
            <field name="model">party.party</field>
            <field name="type">form</field>
            <field name="name">party_form</field>
        </record>
        <record model="ir.action.act_window" id="act_party_form">
            <field name="name">Parties</field>
            <field name="res_model">party.party</field>
        </record>

First we specify model for party_view_tree with this line:

            <field name="model">party.party</field>

Then we do the same for party_view_form.

And finally we specify the same model in definition of act_party_form:
            <field name="res_model">party.party</field>

I am asking this because this looks to me as unnecessary complication. Can someone explain to me why we have to do this way?

Regards,
Marko

Cédric Krier

unread,
Dec 7, 2016, 12:00:08 AM12/7/16
to tryton
On 2016-12-06 10:18, Marko Randjelovic wrote:
> When making Tryton module, when we define act_window object, we specity
> res_model. Why, since we already specify model in definition of view which
> is to be displayed in the act window?

Because the action could have no view and/or the view could have no
action.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
Reply all
Reply to author
Forward
0 new messages