[FIX] account_payment_sale: Compatibility with account_banking_sepa_direct_debit

Steps to reproduce the problem:

- Set a payment mode with fixed journal and set the journal with bank account A.
- Create a sales order and put bank account B.
- Create invoice.
- Bank account in invoice is A instead of B.
This commit is contained in:
Carlos Dauden
2020-01-13 18:09:41 +01:00
committed by Pedro M. Baeza
parent b52ffec630
commit 02cd4e2381

View File

@@ -14,7 +14,8 @@ class SaleOrder(models.Model):
def _get_payment_mode_vals(self, vals):
if self.payment_mode_id:
vals['payment_mode_id'] = self.payment_mode_id.id
if self.payment_mode_id.bank_account_link == 'fixed':
if (self.payment_mode_id.bank_account_link == 'fixed' and
self.payment_mode_id.payment_method_id.code == 'manual'):
vals['partner_bank_id'] =\
self.payment_mode_id.fixed_journal_id.bank_account_id.id
return vals