dnl.re
dnl.re

Reputation: 393

Replacing a field in an already inherited view through view inheritance (Odoo 8)

The sale_stock_view.xml from sale_stock module extends the sale_view.xml from the sale module through inheritance and adds among others the warehouse_id:

sale_stock_view.xml:

        <record id="view_order_form_inherit" model="ir.ui.view">
            <field name="name">sale.order.form.sale.stock</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <data>
                    ...
                    <field name="client_order_ref" position="after">
                         <field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" options="{'no_create': True}" groups="stock.group_locations"/>
                    </field>

I want to delete the warehouse_id by inheriting the .xml from the sale_stock module through an empty field with position="replace":

My .xml in my own module:

<?xml version="1.0" encoding="utf-8"?>
    <openerp>
    <data>
        <record id="view_order_form_inherit_mymodule" model="ir.ui.view">
                <field name="name">sale.stock.sale.order.form.mymodule</field>
            <field name="model">sale_stock.sale_order</field>
            <field name="inherit_id" ref="sale_stock.view_order_form_inherit"/>
            <field name="arch" type="xml">
                <field name="warehouse_id" position="replace"/>
            </field>
        </record>
    </data>
</openerp>

The error message:

ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition

Error details:
Konnte Modell nicht finden: sale_stock.sale_order

Fehler Kontext:
Ansicht `sale.stock.sale.order.form.mymodule`
[view_id: 1470, xml_id: k. A., model: sale_stock.sale_order, parent_id: 783]" while parsing /home/tertia/workspace/odoo8/custom_modules/mymodule/views/sale/sale_view.xml:4, near
<record id="view_order_form_inherit_mymodule" model="ir.ui.view">
                    <field name="name">sale.stock.sale.order.form.mymodule</field>
                    <field name="model">sale_stock.sale_order</field>
                    <field name="inherit_id" ref="sale_stock.view_order_form_inherit"/>
                    <field name="arch" type="xml">
                        <field name="warehouse_id" position="replace"/>
                    </field>
                </record>

Error message is in German but translates to Model could not be found: sale_stock.sale_order I tried various models like sale_stock.sale_stock.sale_order, sale.order, or simply sale_order but every attempt results in the same error message.

Upvotes: 1

Views: 2546

Answers (1)

Andrei Boyanov
Andrei Boyanov

Reputation: 2393

In my mind the model you want to deal with is just sale.order. There is not a sale_order model in the sale_stock module as far as I know.

Upvotes: 1

Related Questions