As you can see in the code bellow, I use "inherits" statement to have the print_comment field available in product.template model. I must use inherits because I want a set of fields available in multiple model. The problem is when I want to show it on a view. When I do it and access a record in the product listing, I get the following error:
The requested operation cannot be completed due to security restrictions. Please contact your system administrator.
(Document type: product.template, Operation: read)
What's wrong? We can find what access or record rules to set if that's the culprit... we also use the admin account to test so there shouldn't be any rules applied right???
Please help!!!
product.py
from openerp import api, fields, models class
ProductTemplate(models.Model):
_inherit = 'product.template'
_inherits = {'print.specs': 'print_specs_id'}
print_specs_id = fields.Many2one('print.specs', string='Print Spectification', ondelete="cascade", required=True)
print_specs.py
# -*- encoding: utf-8 -*-
from openerp import api, fields, models, _
# bag of print specs
class PrintSpecs(models.Model):
_name = 'print.specs'
print_comment = fields.Char(string='Comment sur impression', help='Comment sur impression seulement')
product.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_template_devis_form_view" model="ir.ui.view">
<field name="name">product.template.devis.form.view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="type" position="after">
<field name="print_comment" />
</field>
</field>
</record>
</data>
</openerp>
Manifest:
{
'name' : "Product Devis TEST",
'description': "Fro test",
'author' : "ML",
'category' : 'Technical Settings',
'version' : '0.1',
'depends' : ['product','sale'],
'data' : ['views/product.xml'],
}