This Odoo technical development blog is my way to contribute back to the Odoo Community, for all the selfless and great sharing by the community members.
If you have inherited the Odoo model and would like to have a different Form, Tree, Pivot, Calendar view for your inherited model, the following code will be useful.
You may also have your own search filter, without inheriting from the parent search view.
Click "Like" at the bottom of this blog, to motivate us to continue sharing more Odoo tips.
<record id="action_my_job" model="ir.actions.act_window">
<field name="name">Job 1</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">my.model</field>
<field name="view_mode">tree,form,calendar</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_tree_my_job')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_form_my_job')}),
(0, 0, {'view_mode': 'calendar', 'view_id': ref('view_calendar_my_job')})]"
/>
<field name="search_view_id" ref="view_search_my_job"/>
<field name="domain">[('job_category','=','local')]</field>
</record>
If you wish that your one2Many field can be direct to a specific custom form view, you may use the following:
<field name="my_one2Many_field" context="{'form_view_ref': 'module_name.view_form_record_id'}"/>
Kommentare