Search code examples
odooodoo-10odoo-view

Odoo 10: Add extra fields to the product form


I want to add a couple of extra fields to the product form, right after 'standard_price'.

I created a view that inherits from "product.product_template_form_view" and added my fields there:

<field name="standard_price" position="after">
        <field name="my_field" />
</field>

I then restart odoo updating the module, but I don't see my new fields when I call the product form.

The fields appear on the database model (created inherited models also), but not on the user interface.

What I'm missing here?


Solution

  • Check these things:

    • Inherited from correct base form product.template.common.form
    • Make sure you are looking at correct form for product.template (Product), not product.product (Product Variant).
    • Do you see the input field without caption in edit mode? If this is the case, you can have broken structure in the html level. Next bullet will solve this.
    • Standard_price field has unique html structure because it can have unit of measure (uom) connected to it. Try connecting to simple field or use the container div standard_price_uom for connection, see template code below.

    Template code for working view with a new field after standard_price_uom div:

    <div name='standard_price_uom' position="after">
      <field name="my_field" />
    </div>
    

    If these does not help, please provide whole view definition.