class inherit_details(osv.osv):
_inherit="project.task"
_inherit="sale.order.line"
_columns = {
'description':fields.text('Description',size=10),
'debit': fields.boolean('Debit'),
'credit': fields.boolean('Credit'),
'salesDetail':fields.char('SalesDetails',size=20,required=True),
'salestax':fields.char('SalesTax',size=10,required=True),
}
inherit_details()
------------------------------------------------xml file--------------------
<record id="inherit1_form_view" model="ir.ui.view">
<field name="name">project.task.form</field>
<field name="model">project.task</field>
<field name="type">form</field>
<field name="inherit_id" ref="project.view_task_form2"></field>
<field name="arch" type="xml">
<xpath expr="/form/sheet/group/group/field[@name='project_id']"
position="before">
<field name="description" />
</xpath>
<xpath expr="//field[@name='user_id']"
position="after">
<field name="debit" type="checkbox"/>
<field name="credit" type="checkbox"/>
</xpath>
</field>
</record>
<record id="saleinherit_form_view" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="type">form</field>
<field name="inherit_id" ref="sale.view_order_form"></field>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[@string='Order Lines']/field[@name='order_line']/tree/field[@name='product_id']"
position="attributes">
<attribute name="string">ProductDetails</attribute>
</xpath>
<xpath expr="/form/sheet/notebook/page[@string='Order Lines']/field[@name='order_line']/tree/field[@name='price_subtotal']"
position="before">
<field name="salesDetail" />
</xpath>
<xpath expr="/form/sheet/notebook/page[@string='Order Lines']/field[@name='order_line']/tree/field[@name='tax_id']"
position="replace">
<field name="salestax" />
</xpath>
</field>
</record>
-------------------------------------------------------------------Run----------------------------------
if run above code, it produce error below
ERROR:
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Field `credit` does not exist
Error context:
View `project.task.form`
[view_id: 1221, xml_id: Inheritance.inherit1_form_view, model: project.task, parent_id: 785]" while parsing /home/next/workspace/odoo-8/openerp/addons/Inheritance/views/inheritance.xml:5, near
<record id="inherit1_form_view" model="ir.ui.view">
<field name="name">project.task.form</field>
<field name="model">project.task</field>
<field name="type">form</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<data><xpath expr="/form/sheet/group/group/field[@name='project_id']" position="before">
<field name="description"/>
</xpath>
<xpath expr="//field[@name='user_id']" position="after">
<field name="debit" type="checkbox"/>
<field name="credit" type="checkbox"/>
</xpath>
</data></field>
</record>