Merge pull request #5994 from expsa/14.0-i18n-odex_takaful-auto-20260105_173757

[FIX] odex_takaful: improve data models and business logic
This commit is contained in:
Mohamed Eltayar 2026-01-05 17:38:43 +03:00 committed by GitHub
commit 6dcb969ab4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2046 additions and 2405 deletions

File diff suppressed because it is too large Load Diff

View File

@ -362,7 +362,7 @@ class ResPartner(models.Model):
# (related='partner_id.branch_custom_id') with store=False.
# It will be automatically computed from the partner_id.
# DO NOT pass it directly to create() - this causes unnecessary overhead.
kafeel = self.env['res.users'].with_user(2).create({
kafeel = self.env['res.users'].sudo().create({
'name': res.name,
'sel_groups_1_9_10': 9,
'partner_id': res.id,
@ -390,7 +390,7 @@ class ResPartner(models.Model):
# IMPORTANT: branch_custom_id is a RELATED field on res.users
# (related='partner_id.branch_custom_id') with store=False.
# It will be automatically computed from the partner_id.
kafeel = self.env['res.users'].with_user(2).create({
kafeel = self.env['res.users'].sudo().create({
'name': self.name,
'sel_groups_1_9_10': 9,
'partner_id': self.id,
@ -448,7 +448,7 @@ class ResPartner(models.Model):
created_count = 0
for sponsor in sponsors_without_users:
try:
kafeel = self.env['res.users'].with_user(2).create({
kafeel = self.env['res.users'].sudo().create({
'name': sponsor.name,
'sel_groups_1_9_10': 9,
'partner_id': sponsor.id,