Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4201 มุมมอง

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 ?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน

Thanks Waleed !

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
พ.ย. 20
11976
0
ก.ย. 19
3349
Is it supported to alter an action? แก้ไขแล้ว
1
ต.ค. 18
3420
0
ต.ค. 18
2643
4
ก.พ. 25
2736