thank you for your answer :) but i've already done that and it gives me this error so i uncomment it
File "C:\Workspace\Odoov8\odoo\openerp\tools\convert.py", line 978, in convert_xml_import
relaxng.assert_(doc)
File "lxml.etree.pyx", line 3384, in lxml.etree._Validator.assert_ (src\lxml\lxml.etree.c:166555)
AssertionError: Invalid attribute type for element field, line 11
i'm not trying to add any fields!i just want to inherit the billing view as it is
Update:
think you for ur help but i've tried your solution but it's not working either
Error:
'de': fields.char('DE Test', size=64),
AttributeError: 'module' object has no attribute 'char'
Update
I've version 8 of odoo!and yes i know how to add a fields and i've already create myself a billing module!i was working on it until i've found the inherit notion and it sound maybe better to inherit the billing view then to start it from scratch!
Update(Temur):
for server version I could not guess, as your python code completely in v7.0 style. you can compare it to v8 version that I've added in my answer. anyway both should work, actually there is about 3-5 line python code in dimo_dimo definition, what is wrong in this 3 line you can say? Where come from a strange Error you posted above? very interesting case...
Update(takwa)
hey again,
well,i really appreciate your help!the code you give me with version 8 worked for me!but i still not reach my goal!because what i want is a separate custom module that shows the billing view not 'DE Test' added to the actually account module.
so i've tried this :
from openerp import models, fields
class dimo dimo(models.Model):
_name = 'dimo.dimo' # give a name to my custom module
_inherit = 'account.invoice'
de = fields.Char('DE Test', size=64)
and it gives me this error:
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Field `de` does not exist
Error context:
View `my.module.name.account.invoice.tree`
[view_id: 1087, xml_id: dimo.invoice_tree, model: account.invoice, parent_id: 636]" while parsing file:///C:/Workspace/Odoov8/odoo/addons/dimo/views/dimo_view.xml:4, near
<record id="invoice_tree" model="ir.ui.view"> <!-- you can, but it's NOT necessary to change "id" property, I suggest leave as in parent -->
<field name="name">my.module.name.account.invoice.tree</field> <!-- you have to change it, I suggest to prefix it with you module name (dots instead of underscores) -->
<field name="model">account.invoice</field> <!-- better is to avoid to change this -->
<field name="inherit_id" ref="account.invoice_tree"/>
<field name="arch" type="xml"> <!--mandatory! -->
<field name="state" position="after">
<field name="de"/>
</field> </field> </record>
help please :'(
UPDATE(Temur)
read this doc: https://www.odoo.com/documentation/8.0/reference/orm.html#inheritance-and-extension
if you want simple add new fields, it's not necessary to change "_name" of model. you can leave account.account as model name and add or override stuff... that's a common way... but change a name, it's a bit advanced approach, read link that I posted above to understand how it works. but if you're sure you've to change name, then same time as you change "_name" in python, try to change model name in XML as well:
<field name="model">dimo.dimo</field>
but as I commented early, that's not recommended to change name, unless you've good understanding of it's impact. actually it'll create separated table dimo_dimo in database, rather then adding new fields to the existing account_invoice database table. this way dimo_dimo records are going to be independent records. is that your requirement?
Update(takwa)
hey there :) what i want is a menu shows called billing (new module) witch inherit only the belling view from the account moduleI "prototype inheritance ", i will hide the account module so the user can only see the belling view i dont want him to acces to other account action!My idea was first to hide account and create a custom module "belling" from the scratch but when i found out the inherit notion i thought it may be easy that way!brief,i dont want to add new fields just inherit the belling view.you said it's not recommended!is there another method?any suggestion? help me please!this is my code:
class test_test(models.Model):
_name = 'test.test'
_inherit = 'account.invoice'
de = fields.Text(string='Des', required=True)
and the xml :
<record id="invoice_tree" model="ir.ui.view">
<field name="name">module.name.account.invoice.tree</field>
<field name="model">test.test</field>
<field name="inherit_id" ref="account.invoice_tree" />
<field name="arch" type="xml">
<field name="state" position="after">
<field name="de" /> </field> </field> </record>
help please!!!i get this erreur:
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Field `de` does not exist
Error context:
View `account.invoice.form.inherit`
[view_id: 1092, xml_id: test.view_account_invoice_inherit_form, model: account.invoice, parent_id: 638]" while parsing file:///C:/Workspace/Odoov8/odoo/addons/test/views/dimo_view.xml:27, near
<record model="ir.ui.view" id="view_account_invoice_inherit_form">
<field name="name">account.invoice.form.inherit</field>
<field name="model">account.invoice</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="de"/>
</field> </field> </record>