[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 Atchuthan Ubendran
parent 0d72bf368a
commit 513bab9379
2 changed files with 5 additions and 2 deletions

View File

@@ -4,7 +4,7 @@
{
"name": "Account Payment Sale",
"version": "13.0.1.1.0",
"version": "13.0.1.1.1",
"category": "Banking addons",
"license": "AGPL-3",
"summary": "Adds payment mode on sale orders",

View File

@@ -26,7 +26,10 @@ 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[
"invoice_partner_bank_id"
] = self.payment_mode_id.fixed_journal_id.bank_account_id.id