[FIX] account: make action consistent with smart button value

Total invoiced is computed with `active_test=False` [1], however the
corresponding action didn't have that context. Since Odoo 14 `child_of` domain
filters out unaccessible records (including archived ones) [2].

Fix it by adding the context to the action.

STEPS:

1. Have a active contact that has an amount invoiced (invoices pointing to this contact name).
2. Click through on the amount invoiced button, and receive a list of relevant invoices.
3. Now go back to the contact, and archive the contact.
4. The smart button containing the amount invoiced stays the same.
5. Click through on the smart button again

BEFORE: no invoices
AFTER : listed invoices corresponds to the computed total value

[1]: https://github.com/odoo/odoo/blob/574ca75ab6fa583aabc0c1cfc65206e72864e546/addons/account/models/partner.py#L379
[2]: https://github.com/odoo/odoo/commit/3e1b960acf3f6a726338476ba9e62e5ef5c84ef9

opw-2853525

closes odoo/odoo#91828

X-original-commit: bf96188abbf8ad19d1a2f8f82a1e6248245778b5
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
This commit is contained in:
Ivan Yelizariev
2022-05-20 10:56:50 +02:00
parent cc6c5d3b64
commit 5f7602f4e1
+1 -1
View File
@@ -568,7 +568,7 @@ class ResPartner(models.Model):
('move_type', 'in', ('out_invoice', 'out_refund')),
('partner_id', 'child_of', self.id),
]
action['context'] = {'default_move_type':'out_invoice', 'move_type':'out_invoice', 'journal_type': 'sale', 'search_default_open': 1}
action['context'] = {'default_move_type':'out_invoice', 'move_type':'out_invoice', 'journal_type': 'sale', 'search_default_open': 1, 'active_test': False}
return action
def action_view_partner_with_same_bank(self):