I'm trying to modify a view from the CRM module from a custom module with no luck. Currently, from the debugging interface, I can see that my inherited views are being created alongside the views they are meant to modify and end up being straight copies of the inherited view with no modifications.
Here is the view's code:
<!-- Phonecalls Form View -->
<record model="ir.ui.view" id="crm_case_phone_form_view">
<field name="name">CRM - Phone Call Form</field>
<field name="model">crm.phonecall</field>
<field name="type">form</field>
<field name="inherited_id" ref="crm.crm_case_phone_form_view"/>
<field name="arch" type="xml">
<field name="partner_phone" position="replace"/>
<field name="user_id" position="replace"/>
<field name="duration" position="replace"/>
<field name="partner_mobile" position="replace"/>
<field name="priority" position="replace"/>
</field>
</record>
As you can see, I'm just tryting to remove a few fields, but after restarting openerp and updating my module nothing changes at all on the view.
EDIT:
Here are the four files that I have in my module.
__openerp__.py
{
"name" : "Hotel CRM Customizations",
"version" : "0.01",
"category" : "Generic Modules/Hotel Management",
"description": """
Module to to customize the CRM module to be more useful for the hotel industry
""",
"depends" : ["crm"],
"data": [
"crm_phonecall_menu.xml",
"crm_phonecall_view.xml",
],
"auto_install": False,
"installable": True
}
__init__.py is blank
crm_phonecall_menu.xml (this modification actually works)
<?xml version="1.0"?>
<openerp>
<data>
<!-- PHONE CALLS (menu) -->
<menuitem name="Call Log" id="crm.menu_crm_case_phone"
groups="base.group_sale_salesman"
parent="base.menu_base_partner" sequence="4" />
</data>
</openerp>
crm_phonecall_view.xml
<?xml version="1.0"?>
<openerp>
<data><!-- Phonecalls Form View -->
<record model="ir.ui.view" id="crm_case_phone_form_view_inherit">
<field name="name">CRM - Phone Call Form</field>
<field name="model">crm.phonecall</field>
<field name="sequence">14</field>
<field name="inherited_id" ref="crm.crm_case_phone_form_view"/>
<field name="arch" type="xml">
<field name="partner_phone" position="attributes">
<attribute name="invisible">True</attribute>
</field>
<field name="user_id" position="attributes">
<attribute name="invisible">True</attribute>
</field>
<field name="duration" position="replace"/>
<field name="partner_mobile" position="replace"/>
<field name="priority" position="replace"/>
</field>
</record>
</data>
</openerp>
Seems like some of the comment has been trimmed, so usage is .
Ah, very well spotted on the inherit! On the position tag, it is a common way to do that. This is the equivalent of . You could also use Xpath, but the OpenERP built-in is much easier!
"inherited_id" was the problem. After changing it to "inherit_id" everything is working properly. Thank you so much for noticing that!
First, when you inherit a view, use field name="inherit_id" instead of inherited_id. Second, remove sequence from the xml view - you do not need that for inherited view, which deals with attributes. Third, i do not understand your position="replace" usage of fields like duration partner_mobile or priority - if you use replace, the schema is like
I tried to convert your, Mariusz's, comment to an answer, but it created it under my name for some reason. I've accepted your answer instead.