Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
4211 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis

Thanks Waleed !

Post Terkait Replies Tampilan Aktivitas
3
Nov 20
11981
0
Sep 19
3354
1
Okt 18
3424
0
Okt 18
2651
4
Feb 25
2759