[FIX] account: aged partner: partner can be unknown

Have one move with
- one debit in receivable with a partner which has a partner.category on it
- one other debit in receivable, without a partner
- one credit wherever

Open the aged partner balance report, filter partners on the relevant tag (partner.category)

Do the same with a move with an earlier date that will put the amounts in a different column

Before this commit, it crashed because some result variable did not contain
the key "False"

After this commit, it doesn't crash

OPW 1933749

closes odoo/odoo#30603
This commit is contained in:
Lucas Perais (lpe)
2019-01-28 12:03:03 +00:00
parent a1bb59e54d
commit 6a24660f7e
@@ -142,6 +142,7 @@ class ReportAgedPartnerBalance(models.AbstractModel):
if not self.env.user.company_id.currency_id.is_zero(line_amount):
partners_amount[partner_id] += line_amount
lines.setdefault(partner_id, [])
lines[partner_id].append({
'line': line,
'amount': line_amount,
@@ -179,6 +180,7 @@ class ReportAgedPartnerBalance(models.AbstractModel):
line_amount -= partial_line.company_id.currency_id._convert(partial_line.amount, user_currency, user_company, date_from)
if not self.env.user.company_id.currency_id.is_zero(line_amount):
undue_amounts[partner_id] += line_amount
lines.setdefault(partner_id, [])
lines[partner_id].append({
'line': line,
'amount': line_amount,