[FIX] account: dashboard domain

- Go to Accounting
- On Customer Invoices kanban card, click on the 3 dots > Credit Notes

Invoices, credit notes and receipts are shown.

This happens because the action domain is overridden, while it shouldn't
be in this case.

We only set the action domain if the action name was not explicitly
requested.

opw-2242195

closes odoo/odoo#50052

X-original-commit: 5dab4d56055cc197fb0f3a6cd20e60cd0f638fa9
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-04-23 09:55:10 +00:00
parent 13cacdfde9
commit 6ff823b2f6
@@ -470,10 +470,13 @@ class account_journal(models.Model):
domain_type_field = action['res_model'] == 'account.move.line' and 'move_id.move_type' or 'move_type' # The model can be either account.move or account.move.line
if self.type == 'sale':
action['domain'] = [(domain_type_field, 'in', ('out_invoice', 'out_refund', 'out_receipt'))]
elif self.type == 'purchase':
action['domain'] = [(domain_type_field, 'in', ('in_invoice', 'in_refund', 'in_receipt'))]
# Override the domain only if the action was not explicitly specified in order to keep the
# original action domain.
if not self._context.get('action_name'):
if self.type == 'sale':
action['domain'] = [(domain_type_field, 'in', ('out_invoice', 'out_refund', 'out_receipt'))]
elif self.type == 'purchase':
action['domain'] = [(domain_type_field, 'in', ('in_invoice', 'in_refund', 'in_receipt'))]
return action