Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4200 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

Thanks Waleed !

Related Posts Odpovědi Zobrazení Aktivita
3
lis 20
11975
0
zář 19
3349
1
říj 18
3418
0
říj 18
2643
4
úno 25
2735