[FIX] account: performance in issued total
When a partner has a lot of contacts, the computation of the issue total takes a lot of time. Indeed, it performs the computation for the partner, but also for all the children, despite the fact that the amount is not displayed. opw-726355
This commit is contained in:
@@ -349,12 +349,9 @@ class ResPartner(models.Model):
|
||||
def _compute_issued_total(self):
|
||||
""" Returns the issued total as will be displayed on partner view """
|
||||
today = fields.Date.context_today(self)
|
||||
for partner in self:
|
||||
domain = partner.get_followup_lines_domain(today, overdue_only=True)
|
||||
issued_total = 0
|
||||
for aml in self.env['account.move.line'].search(domain):
|
||||
issued_total += aml.amount_residual
|
||||
partner.issued_total = issued_total
|
||||
domain = self.get_followup_lines_domain(today, overdue_only=True)
|
||||
for aml in self.env['account.move.line'].search(domain):
|
||||
aml.partner_id.issued_total += aml.amount_residual
|
||||
|
||||
@api.one
|
||||
def _compute_has_unreconciled_entries(self):
|
||||
|
||||
Reference in New Issue
Block a user