I am trying to create a module that allows me to assign products to categories determined by external websites (for example Amazon and eBay categories). Each external category can have many products in it, and each product can be in many categories, one for each external site. Everything works until I try to create a many2many relationship between my external_categories and product.template.
My external_categories class looks a lot like the category class in product, it's name is: _name = "external_categories.category"
The class I am trying to create the many2many relationship in is:
class product_template(osv.osv):
_inherit = "product.template"
_columns = {
'ext_cat_prod_ids': fields.many2many('external_categories.category', 'ext_cat_prod_rel', 'prod_id', 'ext_cat_id', 'External Categories'),
}
product_template()
I know that I am inheriting product.template, and in the XML sample below I am using the model product.product. I have tried every combination of the two (product.template and product.product) in both locations without luck.
I am trying to add a tab to the product page on the front end. In this tab I will be able to add the product to multiple categories, my XML is:
<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form.inherit</field>
<field name="model">product.product</field>
<field name="priority">6</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="External Categories">
<group name="properties">
<group>
<field name="ext_cat_prod_ids" colspan="2" widget="many2many_tags"/>
</group>
</group>
</page>
</notebook>
</field>
</record>
When I try to install the module I get an error, this is from the log:
2014-07-27 19:33:46,736 1396 ERROR newVeroTemp openerp.osv.orm: Can't find field 'ext_cat_prod_ids' in the following view parts composing the view of object model 'product.product':
* product.normal.form.inherit
Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model
2014-07-27 19:33:46,736 1396 ERROR newVeroTemp openerp.addons.base.ir.ir_ui_view: Can't render view for model: product.product
Traceback (most recent call last):
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\base\ir\ir_ui_view.py", line 126, in _check_render_view
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\stock\product.py", line 441, in fields_view_get
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\orm.py", line 2278, in fields_view_get
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\orm.py", line 1955, in __view_look_dom_arch
except_orm: ('View error', u"Can't find field 'ext_cat_prod_ids' in the following view parts composing the view of object model 'product.product':\n * product.normal.form.inherit\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model")
2014-07-27 19:33:46,740 1396 ERROR newVeroTemp openerp.tools.convert: Parse error in file:///C:/Program Files (x86)/OpenERP 7.0-20140622-231040/Server/server/openerp/addons/external_categories/external_categories.xml:142:
<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form.inherit</field>
<field name="model">product.product</field>
<field name="priority">6</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="External Categories">
<group name="properties">
<group>
<field name="ext_cat_prod_ids" colspan="2" widget="many2many_tags"/>
</group>
</group>
</page>
</notebook>
</field>
</record>
Traceback (most recent call last):
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\tools\convert.py", line 852, in parse
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\tools\convert.py", line 819, in _tag_record
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\base\ir\ir_model.py", line 971, in _update
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\base\ir\ir_ui_view.py", line 103, in create
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\orm.py", line 4551, in create
File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\orm.py", line 1562, in _validate
except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')
2014-07-27 19:33:46,740 1396 ERROR newVeroTemp openerp.netsvc: ValidateError
Error occurred while validating the field(s) arch: Invalid XML for View Architecture!
Thank you in advance for any help our guidence you can provide in the use of many2many relationships.