Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Inheritance works but Error details: Field `credit` does not exist if run this code,How can i solve this?

By
Arunkumar
on 8/24/16, 5:24 AM 186 views

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>

0

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 8/25/16, 6:20 AM

Arun,

update ur module from terminal using ./openerp-server -u <module_name> this field is not created in DB... once you upgrade it will be add to your table and this error will not come.

if i update the module above error shows

Arunkumar
on 8/25/16, 7:35 AM

ok, on ir_module_module table in DB, get those records which are in 'to upgrade' state, if found then change their state to 'uninstalled', and then upgrade your module again..

hope it should work

Pawan
on 8/25/16, 7:55 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/24/16, 5:24 AM
Seen: 186 times
Last updated: 8/25/16, 6:20 AM