[FIX] account: invoice context from payment smart button is correct
Register a payment on a vendor bill. From the menu Account > Purchase > Payment, clik to see that payment click on the smart button to see the invoices Create a new Bill Before this commit, the default type and journal of the new bill were actually the ones of a customer invoice After this commit, those defaults are the ones of a vendor bill OPW 2038786 closes odoo/odoo#34967 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
@@ -430,20 +430,25 @@ class account_payment(models.Model):
|
||||
|
||||
@api.multi
|
||||
def button_invoices(self):
|
||||
if self.partner_type == 'supplier':
|
||||
views = [(self.env.ref('account.invoice_supplier_tree').id, 'tree'), (self.env.ref('account.invoice_supplier_form').id, 'form')]
|
||||
else:
|
||||
views = [(self.env.ref('account.invoice_tree').id, 'tree'), (self.env.ref('account.invoice_form').id, 'form')]
|
||||
return {
|
||||
action = {
|
||||
'name': _('Paid Invoices'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.invoice',
|
||||
'view_id': False,
|
||||
'views': views,
|
||||
'type': 'ir.actions.act_window',
|
||||
'domain': [('id', 'in', [x.id for x in self.invoice_ids])],
|
||||
}
|
||||
if self.partner_type == 'supplier':
|
||||
action['views'] = [(self.env.ref('account.invoice_supplier_tree').id, 'tree'), (self.env.ref('account.invoice_supplier_form').id, 'form')]
|
||||
action['context'] = {
|
||||
'journal_type': 'purchase',
|
||||
'type': 'in_invoice',
|
||||
'default_type': 'in_invoice',
|
||||
}
|
||||
else:
|
||||
action['views'] = [(self.env.ref('account.invoice_tree').id, 'tree'), (self.env.ref('account.invoice_form').id, 'form')]
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
def button_dummy(self):
|
||||
|
||||
Reference in New Issue
Block a user