Hello,
my goal is to add a new model that holds new data for some categories. Not all categories needs this data. So I think inherit is not the right way, becouse if I use inheritance, every time I create a new category it will create a new row in my osc_product_category
table with empty data. I want that a new row is created only when e.g. osc_category_id
is set.
I want that all the new fields are shown in the product categories form. But it's not working.
class osc_product_category(osv.osv):
_name = 'osc.product.category'
_description = "osCommerce Product Category"
_columns = {
'product_category_id': fields.many2one('product.category', 'Product Category', ondelete="cascade", select=True),
'osc_category_id': fields.integer('osCommerce Category Id'),
...
}
osc_product_category()
.
<record id="nfx_oscommerce_product_category_form_view" model="ir.ui.view">
<field name="name">nfx_oscommerce.product.category.form</field>
<field name="model">osc.product.category</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet" position="inside">
<notebook>
<page string="osCommerce">
<group>
<group>
<field name="osc_category_id"/>
...
</group>
</group>
</page>
</notebook>
</xpath>
</field>
</record>
I get an exception that parent_id
was not found... I don't understand why. parent_id
is in product.category
. I don't need it in my osc.product.category
.
How can I inherit a view and add fields from another model?
Did you ever figure out how to do this? I'm working on exactly the same problem now