Search code examples
odooodoo-8odoo-10

What are the difference between res_model, src_model and model terminology in odoo 10?


These three terminologies can be seen in XML and python files, so can anyone please explain its usage, and what are the effects of these keywords?


Solution

  • <act_window
        id="act_test_test"
        name="Am here"
        res_model="account.move.line"
        context="{'search_default_unreconciled':1, 'search_default_payable':1}"
        domain="[('partner_id', '=', False)]"
        src_model="account.invoice"/>
    

    In the above example code, act_window is used to create a window action of a particular model. Here it is account.move.line. That is res_model is used to define a resource model.

    Now you have an action you need to call it from somewhere. To do that you have to define a menu link. This task is done by src_model. You define a model name and the menu link will appear under a submenu of Action/More in form/list view. In the above example, I have defined account.invoice, so the menu will appear under 'Action' in form/list view of 'account.invoice model'. enter image description hereenter image description here

    This is what I understood. Hope it will help you.