I'm trying to extend the sale.order model to have a relation with an email chain model I've created in my custom module. So I created this:
class sales_order_email_field(osv.Model):
_name = 'sale.order'
_inherit = 'sale.order'
_columns = {
'email_chain': fields.many2one(
'sale.order_email.collection',
'Email Chain',
required=False
)
}
sales_order_email_field()
and in my XML:
<record id="view_res_sale_line_email_chain_form" model="ir.ui.view">
<field name="name">sale.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="type">form</field>
<field name="priority" eval="8"/>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='product_uom_qty']"
position="after">
<field name="email_chain"/>
</xpath>
</data>
</field>
</record>
Buy I get an error message:
Error details: Field `email_chain` does not exist
What am I doing wrong?
Hi, Just make sure that your .py file is imported into __init__.py file. And then just install / upgrade your custom module.
The python file is loaded.