|
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
|
Hi,
You may try like this:
class.py:
from openerp import models, fields, api
class equipment(models.Model):
_inherit = 'product.template'
model_mat = fields.Char('Model de materiel')
num_ligne = fields.Integer('N° ligne')
equipment_view.xml:
<openerp>
<data>
<record id="view_product_form_inherit" model="ir.ui.view">
<field name="name">product.template.common.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//page[1]" position="inside">
<group>
<field name="model_mat"/>
<field name="num_ligne"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>
And please note when you inherit multiple models, use _inherits instead of _inherit.
Actually, it is perfectly acceptable to have multiple modules in an "inherit". The two (inherits vs. inherits) change the design of the models differently. https://www.odoo.com/documentation/8.0/reference/orm.html#reference-orm-inheritance It is also possible for a model to use both "inherit" and "inherits" to achieve whatever their desired result is.
You are right Travis, it is possible to use _inherit and _inherits together. But when you are inheriting multiple models, can you use like _inherit = 'model.one', 'model.two' ?
it worked thankyou,but only after seperating classes in other py file, if I may say that the reason why it was not working earlier is that I have declared 2 classes in the same .py file using different objects and importing from different classes the first one using osv.osv the other one using models.Model and when importing each one's fields there happens the Conflict between the two classes because one is declaring a field.Char and the other one is using field.char which causes "as I think" this error that it was giving me : odoo AttributeError: 'module' object has no attribute 'char'
so I was doing like this in same file which is uncorrect I think
from openerp import models, fields, api from openerp.osv import fields, osv
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
3
Aug 24
|
5498 | ||
|
4
Jul 24
|
38806 | ||
Default value in form view
Solved
|
|
5
Apr 23
|
93701 | |
|
3
Nov 22
|
2953 | ||
|
3
Aug 22
|
3037 |