Hello,
I'm trying to create simple addon to add additional field in the product page in the green area
img59.imageshack.us/img59/7929/lesd.png
So far I've synced latest trunc version to my PyDev ide.
Created database with some data in it and made sure openERP works.
crated new addon folder source/addons/z_fivesol/
with following files:
--->__init__.py
import z_fivesol
--->__openerp__.py
{
'name': 'Z_FiveSol Customisations',
'version': '0.1',
'category': 'Tools',
'description': """Additional Product fields for internal ref code and external ref code """,
'author': 'FiveSol',
'depends': ['sale', 'stock', 'purchase'],
'data': [
'z_fivesol_view.xml'
],
'demo': [],
'test': [],
'installable': True,
'auto_install': False,
'images': [],
'css': [],
}
---> z_fivesol.py
from openerp import tools
from openerp.osv import fields, osv<br/>
from openerp.tools.translate import _
class product_product(osv.osv):
_inherit = 'product.product'
_name = 'product.product'
_columns = {
'zCodeFiveSol' : fields.char('Internal Reference', size=64, select=True),
'zBaumCode' : fields.char('Internal Reference', size=64, select=True),
}
product_product()
--->z_fivesol_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="zproduct_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="default_code" position="after">
<field name="zCodeFiveSol"/>
<field name="zBaumCode"/>
</field>
</field>
</record>
</data>
</openerp>
Then I run the openERP trunc(v8) server and try to import my addon... I get quite long stack trace, so I'm adding only the last line, looks like it has the relevant information for my failure...
File "/home/pavel/openERP/v8/source/server/openerp/osv/orm.py", line 1548, in _validate raise except_orm('ValidateError', '\n'.join(error_msgs))
ParseError: "ValidateError
The field(s) 'arch, model' failed against a constraint: The model name does not exist or the view architecture cannot be rendered." while parsing /home/pavel/openERP/v8/source/addons/z_fivesol/z_fivesol_view.xml:4, near <record id="zproduct_normal_form_view" model="ir.ui.view">
I wanted to inherit the product.product model and add two fields to the database, then inherit the product_view.xml-> <page string="Information"> and add those two fields to the product view from the screenshot...
The model product.product exists, so I'd bet that I didn't do properly the naming of the record that I want to modify and the definition of where I want to put the fields... or maybe should have used different names in the .py file... but I found the docu quite confusing and failed to identify my error...Looking forward to your replies. Thank you!
Regards,
Pavel Pavlov