Skip to Content
Menu
This question has been flagged
1 Reply
4382 Views

Hello,

In a created module, I inherit the sale.order.line table and I inherit the sale.view_order_form in my XML to display some fields created in the class.

I have an issue when I want to update my module :

ParseError: Error validating constraint. The 'origin' field does not exist


Python :

class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

conditionnement_id = fields.Many2one('miadi.packaging', 'Packaging', default='')
quantite_conditionnement = fields.Float('Quantité', default=0.00)
poids_total = fields.Float('Poids total', default=0.00)
prix_total = fields.Float('Prix total', default=0.00)


XML :

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="view_miadi_orderline_tree">
            <field name="model">sale.order.line</field>
            <field name="name">view.inherit.miadi.orderline.tree</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="before">
                    <field name="conditionnement_id" ref="product.template.product_variant_id" />
                    <field name="quantite_conditionnement" />
                    <field name="poids_total" />
                    <field name="prix_total" />
                </xpath>
            </field>
        </record>
    </data>
</openerp>


How to fix this problem ?

Thanks for answers.

Avatar
Discard
Author Best Answer

I fix the problem !

In the XML, I replace <field name="model">sale.order.line</field> par <field name="model">sale.order</field>

Avatar
Discard