Skip to Content
Menu
This question has been flagged
1 Reply
3013 Views

I wanted to create a membership child table for res.partner. I wanted to use delegation (_inherits) so that child fields can also be accessed from the parent res.partner table :

class MyMembership(models.Model):
_name = "mymembership"
memberid = fields.Char(string="Membership ID")
member_expiry = fields.Date(string="Expiry Date")​
class MembershipCustomer(models.Model):
_inherit = "res.partner"
_inherits = {
'mymembership': 'partner_member_id',
}
partner_member_id = fields.Many2one('mymembership', ondelete='cascade')
When i click on the sample contact, it gives an error :

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.
(Document type: res.partner, Operation: read)

What did i miss ?

Avatar
Discard
Best Answer

You miss the model access of your new created model MyMembership, you have to create csv file and give access to partner user and manager as below
Create ir.model.access.csv file in Secuiry folder and add it to manifest file ​


"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"

"access_mymembership_group_partner_manager","mymembership group_partner_manager","model_mymembership","base.group_partner_manager",1,1,1,1
"access_mymembership_group_user","mymembership group_user","model_mymembership","base.group_user",1,0,0,0

Avatar
Discard
Author

Thanks Waleed !

Related Posts Replies Views Activity
3
Nov 20
10248
0
Sep 19
2479
1
Oct 18
2176
0
Oct 18
1784
1
Aug 24
424