Replace existing view

Hi,
I want to replace the view account.party_view_form in another module. I have created party.xml with:

<tryton>
    <data>
        <record model="ir.ui.view" id="account.party_view_form">
            <field name="model">party.party</field>
            <field name="inherit" ref="party.party_view_form"/>
            <field name="name">party_form</field>
        </record>
    </data>
</tryton>

With “bin/trytond-admin -c …/…/trytond-6.0.conf … --all” I got the message “loading party.xml” but it isn’t taken into account ( :slight_smile: )
A clue?

Hi,
very sparse information, about what exactly you try to do. But maybe this does work:

another_module/party.xml:

<tryton>
    <data>
        <record model="ir.ui.view" id="party_view_form">
            <field name="model">party.party</field>
            <field name="inherit" ref="party.party_view_form"/>
            <field name="name">party_form</field>
        </record>
    </data>
</tryton>

another_module/tryton.cfg:

[tryton]
…
depends:
    account
    party
    …
xml:
    …
    party.xml

another_module/views/party_form.xml exists

With this, I can add fields to initial view or replace fields.
With “id=“account.party_view_form””, my intent is to totally replace the view

If you want to replace the entire contents of the view you can do it be replacing the root tag of the view. For example, in the form view you can do

<data>
   <xpath expr="/form" position="replace"/>
        your new view definition here. 
   </xpath>
</data>

But such view is just adding some fields on a specific view, so if you want to replace such contents you need to replace the expressions added by this module.

account.party_view_form is an inheriting view so it can not be inherited. You must always inherit the main view.

ok but I would like account.party_view_form be unactivated by my new form. How can I do?
and (of course) I would like that views that inherit from account.party_view_form inherit from my new form.

That’s not possible. You always inherit for the full view (with all the activated modules).
If you want to remove something from such view you should create a module that depends from all the supported modules an removes all the paths that you don’t want.