[FIX] account_payment_mode: Always set company bank account in customer invoices

This commit is contained in:
Carlos Dauden
2019-11-25 13:05:31 +01:00
parent 9e3bd2f6c1
commit da42283194
2 changed files with 20 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
from . import account_invoice
from . import account_payment_method
from . import account_payment_mode
from . import account_journal

View File

@@ -0,0 +1,19 @@
# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
from odoo.tools import config
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
def _get_default_bank_id(self, type, company_id):
"""When OCA payment mode is used we don't want default bank acc"""
context = self.env.context
if config['test_enable'] and not context.get(
'test_account_payment_mode') or context.get(
'force_std_default_bank_id'):
return super()._get_default_bank_id(type, company_id)
else:
return False