Skip to Content
Menu
This question has been flagged
7004 Views

I have created a new module which adds a field to the product form called 'Drawing Number'

I have created the field 'drawing' in the models file and inherited the data from product.template.


class HIP_product_template(models.Model):

_name = 'product.template'

_inherit = 'product.template'

drawing = fields.Char('Drawing Number', required = False)


I have then edited the view in the xml file as follows:


<record model="ir.ui.view" id="HIP_product_template">

<field name="inherit_id" ref="product.product_template_only_form_view"/>

<field name="model">product.template</field>

<field name="arch" type="xml">

<field name="list_price" position="after">

<field name="drawing" placeholder="Drawing no./issue" required="False"/>

</field>

</field>

</record>


This works great, and I can add this new field to all my products. I can also display the field in quotes etc. 

However, if you click Quotation, then click Add an Item, and 'Create and Edit' this brings up the new product form, but it does not contain my adjustments. I cannot find where this alternative form view is coming from as the pop up has no debug options to edit or view the form. 


I have searched all XML documents on addons for <field name="default_code" which also appears on this for, and also <field name="barcode" but I cant locate this strange pop up products form. 

Avatar
Discard

Did you check the 'product_template_form_view' in product module.

Author

Thanks Gopakumar N G. It was actually product.product_normal_form_view, and the model had to be product.product, not product.template. The following code seems to have worked: product.product Part Number Part No. Barcode for D-Note

Author
product.product Part Number Part No. Barcode for D-Note
Author

I cant paste the code in here, but its same as in the original question but with name="inherit_id" ref="product.product_normal_form_view" and name="model">product.product