[FIX] account: dashboard actions search filter

Create a Bill
Register payment
Create the bank statement
Match with the payment
Go to accounting dashboard, hit "Vendor Bill" (open bill list view)
Clear filters
Add filter: Unpaid

Issue: Users should not be able to clear the journal filter when opening
the bill view

This commit align the behavior of the dashboard to the menu entries
by adding a default search domain to the actions instead of the default
search filter

opw-3228450

closes odoo/odoo#128203

X-original-commit: 4e612d5434d8254c3ba44b8a00d7d71bc0ab4084
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2023-07-13 00:46:10 +02:00
parent d534fdaa55
commit f9e09bc7a3
@@ -664,9 +664,7 @@ class account_journal(models.Model):
action['context'] = context
action['context'].update({
'default_journal_id': self.id,
'search_default_journal_id': self.id,
})
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
# Override the domain only if the action was not explicitly specified in order to keep the
@@ -676,7 +674,10 @@ class account_journal(models.Model):
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', 'entry'))]
elif action['domain']:
action['domain'] = ast.literal_eval(action['domain'])
action['domain'] = (action['domain'] or []) + [('journal_id', '=', self.id)]
return action
def open_spend_money(self):