[FIX] account: make open_action() work with actions targetting both account.move and account.move.line

This commit is contained in:
oco-odoo
2019-09-27 09:19:38 +00:00
committed by wan
parent 40f0c28d5e
commit ae2cbfa20f
@@ -494,10 +494,12 @@ class account_journal(models.Model):
'search_default_journal_id': self.id,
})
domain_type_field = action['res_model'] == 'account.move.line' and 'move_id.type' or 'type' # The model can be either account.move or account.move.line
if self.type == 'sale':
action['domain'] = [('move_id.type', 'in', ('out_invoice', 'out_refund', 'out_receipt'))]
action['domain'] = [(domain_type_field, 'in', ('out_invoice', 'out_refund', 'out_receipt'))]
elif self.type == 'purchase':
action['domain'] = [('move_id.type', 'in', ('in_invoice', 'in_refund', 'in_receipt'))]
action['domain'] = [(domain_type_field, 'in', ('in_invoice', 'in_refund', 'in_receipt'))]
return action