[FIX] mass_mailing_sale: use singleton instead of self when getting the UTM domain
Purpose ======= When computing some fields of the mailing, an error can occur if we compute the fields in batch. Task-2227411 closes odoo/odoo#52904 X-original-commit: 933a2f986a72ddb8610d7d93a078d2cb0cb10f16 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Debauche Stéphane
parent
8495f01034
commit
0fe8ba7a42
@@ -16,13 +16,13 @@ class MassMailing(models.Model):
|
||||
def _compute_sale_quotation_count(self):
|
||||
has_so_access = self.env['sale.order'].check_access_rights('read', raise_exception=False)
|
||||
for mass_mailing in self:
|
||||
mass_mailing.sale_quotation_count = self.env['sale.order'].search_count(self._get_sale_utm_domain()) if has_so_access else 0
|
||||
mass_mailing.sale_quotation_count = self.env['sale.order'].search_count(mass_mailing._get_sale_utm_domain()) if has_so_access else 0
|
||||
|
||||
@api.depends('mailing_domain')
|
||||
def _compute_sale_invoiced_amount(self):
|
||||
for mass_mailing in self:
|
||||
if self.user_has_groups('sales_team.group_sale_salesman') and self.user_has_groups('account.group_account_invoice'):
|
||||
domain = self._get_sale_utm_domain() + [('state', 'not in', ['draft', 'cancel'])]
|
||||
domain = mass_mailing._get_sale_utm_domain() + [('state', 'not in', ['draft', 'cancel'])]
|
||||
moves = self.env['account.move'].search_read(domain, ['amount_untaxed'])
|
||||
mass_mailing.sale_invoiced_amount = sum(i['amount_untaxed'] for i in moves)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user