diff --git a/ebill_postfinance/models/ebill_postfinance_invoice_message.py b/ebill_postfinance/models/ebill_postfinance_invoice_message.py
index 95c7bf8df..9ce325637 100644
--- a/ebill_postfinance/models/ebill_postfinance_invoice_message.py
+++ b/ebill_postfinance/models/ebill_postfinance_invoice_message.py
@@ -238,19 +238,9 @@ def _get_payload_params(self):
)
params["amount_by_group"] = amount_by_group
# Get the invoice due date
- date_due = None
- if self.invoice_id.invoice_payment_term_id:
- terms = self.invoice_id.invoice_payment_term_id.compute(
- self.invoice_id.amount_total
- )
- if terms:
- # Returns all payment and their date like [('2020-12-07', 430.37), ...]
- # Get the last payment date in the format "202021207"
- date_due = terms[-1][0].replace("-", "")
- if not date_due:
- date_due = self.format_date(
- self.invoice_id.invoice_date_due or self.invoice_id.invoice_date
- )
+ date_due = self.format_date(
+ self.invoice_id.invoice_date_due or self.invoice_id.invoice_date
+ )
params["date_due"] = date_due
return params
@@ -303,18 +293,9 @@ def _get_payload_params_yb(self):
)
params["amount_by_group"] = amount_by_group
# Get the invoice due date
- date_due = None
- if self.invoice_id.invoice_payment_term_id:
- terms = self.invoice_id.invoice_payment_term_id.compute(
- self.invoice_id.amount_total
- )
- if terms:
- # Get the last payment date
- date_due = terms[-1][0]
- if not date_due:
- date_due = self.format_date_yb(
- self.invoice_id.invoice_date_due or self.invoice_id.invoice_date
- )
+ date_due = self.format_date_yb(
+ self.invoice_id.invoice_date_due or self.invoice_id.invoice_date
+ )
params["date_due"] = date_due
return params
diff --git a/ebill_postfinance/tests/common.py b/ebill_postfinance/tests/common.py
index 45a31a2c8..034ff74d8 100644
--- a/ebill_postfinance/tests/common.py
+++ b/ebill_postfinance/tests/common.py
@@ -53,7 +53,7 @@ def setUpClass(cls):
"l10n_ch_qr_iban": "CH2130808001234567827",
}
)
- cls.terms = cls.env.ref("account.account_payment_term_15days")
+ cls.payment_term = cls.env.ref("account.account_payment_term_advance_60days")
cls.state = cls.env["res.country.state"].create(
{"code": "RR", "name": "Fribourg", "country_id": cls.country.id}
)
diff --git a/ebill_postfinance/tests/examples/invoice_qr_yb.xml b/ebill_postfinance/tests/examples/invoice_qr_yb.xml
index 1cecb7257..e92689658 100644
--- a/ebill_postfinance/tests/examples/invoice_qr_yb.xml
+++ b/ebill_postfinance/tests/examples/invoice_qr_yb.xml
@@ -76,7 +76,7 @@
en
- 2019-07-01
+ 2019-08-20
IBAN
Yes
diff --git a/ebill_postfinance/tests/test_ebill_postfinance_message_yb.py b/ebill_postfinance/tests/test_ebill_postfinance_message_yb.py
index 047226635..c596f3c04 100644
--- a/ebill_postfinance/tests/test_ebill_postfinance_message_yb.py
+++ b/ebill_postfinance/tests/test_ebill_postfinance_message_yb.py
@@ -34,7 +34,7 @@ def setUpClass(cls):
def test_invoice_qr(self):
"""Check XML payload genetated for an invoice."""
self.invoice.name = "INV_TEST_01"
- self.invoice.invoice_date_due = "2019-07-01"
+ self.invoice.invoice_payment_term_id = self.payment_term
message = self.invoice.create_postfinance_ebill()
message.set_transaction_id()
message.payload = message._generate_payload_yb()
diff --git a/ebill_postfinance_server_env/__manifest__.py b/ebill_postfinance_server_env/__manifest__.py
index 490aee782..434f37e8c 100644
--- a/ebill_postfinance_server_env/__manifest__.py
+++ b/ebill_postfinance_server_env/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Server environment for eBill Postfinance",
- "version": "16.0.1.0.0",
+ "version": "17.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Tools",