0
votes

I'm getting set up to write my first OpenERP module. I want to add some fields to a list that is displayed on a Product form view, Procurements tab (View ID 233). If you look at that screen, toward the bottom there is a list titled "Suppliers". By default, this list has headers for "Supplier", "Delivery Lead Time", and "Minimal Quantity". I would like to add in "Product Name" and "Product Code".

If I go into "Manage Views" from the debug menu, it looks like the list comes from this code:

<view view_id=589>
  <group>
    <separator string='Suppliers'>
    <field name='seller_ids'>

The XML for that bit seems to live in addons/purchase/purchase_view.xml in this bit, beginning on line 554:

    <record id="view_product_supplier_inherit" model="ir.ui.view">
        <field name="name">product.normal.supplier.form.inherit</field>
        <field name="model">product.product</field>
        <field name="inherit_id" ref="product.product_normal_form_view"/>
        <field name="arch" type="xml">
            <div name="options" position="inside">
                <field name="purchase_ok"/>
                <label for="purchase_ok"/>
            </div>
            <group name="procurement" position="after">
                 <separator string="Suppliers"/>
                 <field name="seller_ids" context="{'uom_id': uom_id}"/>
            </group>
        </field>
    </record>

I had thought that this would be the view code that I'd need to inherit and override, but now I'm confused. The only field listed is 'seller_ids', but when viewed in the browser, the list displays "Supplier", "Delivery Lead Time", and "Minimal Quantity". Where are these extra fields defined, and how would I get to the point where I can add the fields 'product_name' and 'product_code', both from 'product.supplierinfo'?

1

1 Answers

0
votes

The fields are defined in other view(s) that also inherit product.product_normal_form_view. And are all applied on top of their parent view when that view is displayed.

Make sure your module depends on another module that adds the fields and you can savely use the position="after" attribute to get your fields in the right place