Update internal_transaction.py

This commit is contained in:
zainab2097 2024-10-01 13:44:37 +03:00 committed by GitHub
parent 061b89a0f5
commit 3c80496fb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 2 deletions

View File

@ -26,9 +26,22 @@ class InternalTransaction(models.Model):
cc_ids = fields.Many2many(comodel_name='cm.entity', relation='internal_entity_cc_rel',
column1='internal_id', column2='entity_id', string='CC To')
to_users = fields.Many2many(comodel_name='res.users', string="To Users",related="to_ids.user_id",store=True)
to_users = fields.Many2many(comodel_name='res.users', string="To Users",compute="_compute_to_users",store=True)
cc_users = fields.Many2many(comodel_name='res.users', string="CC Users",related="cc_ids.user_id",store=True)
cc_users = fields.Many2many(comodel_name='res.users', string="CC Users",compute="_compute_cc_users",store=True)
@api.depends('to_ids')
def _compute_to_users(self):
for record in self:
# استخراج المستخدمين المرتبطين بالسجلات في to_ids
users = record.to_ids.mapped('user_id') # استخدام mapped لاستخراج user_id من كل سجل
record.to_users = users
@api.depends('cc_ids')
def _compute_cc_users(self):
for record in self:
# استخراج المستخدمين المرتبطين بالسجلات في cc_ids
users = record.cc_ids.mapped('user_id') # استخدام mapped لاستخراج user_id من كل سجل
record.cc_users = users
project_domain = fields.Many2many('project.project', string='Project Domain')
processing_ids = fields.Many2many(comodel_name='internal.transaction', relation='transaction_internal_rel',