From 3dad4b3cb1cb823ae6ccbf56b990012ceca61d99 Mon Sep 17 00:00:00 2001
From: "Ricardo Gomes Rodrigues (rigr)"
Date: Mon, 1 Aug 2022 09:32:52 +0000
Subject: [PATCH] [IMP] account: improve payment terms with new options
This commit improves the payment terms by:
- making the payment terms lines editable on-the-fly removing the need for a wizard
- refactoring the computation of the payment terms
- adds new demo data for payment terms
- adds an example section where the user can test and preview the due dates and amount of its payment terms
- adding a new parameter "Display terms on invoice". If set, the payment deadlines and respective due amounts will be detailed on invoices.
The refactoring:
- adds a field `months` (months to add after the invoice date)
- adds a field `end_month` (if True, switch to the end of the month after having added months or days)
- renames the field `day_of_the_month` to `days_after` (days to be added after the switching to the end of the month, only if `end_month` is set)
- deletes the field `option` which was too restrictive
- modifies the calculation of the payments terms taking into account these new fields
This allows some combinations that were not possible before.
Example: The French payment terms "30 jours fin de mois le 10" (which should be interpreted as "10 days after the end of the next month") can be encoded as
```
months = 1
days = 0
end_month = True
days_after = 10
```
Task id 2852814
closes odoo/odoo#91490
Related: odoo/enterprise#29661
Related: odoo/upgrade#3524
Signed-off-by: Laurent Smet
---
addons/account/data/account_data.xml | 25 ++-
addons/account/demo/account_demo.xml | 6 +-
addons/account/models/account_payment_term.py | 116 +++++++-----
addons/account/tests/common.py | 7 +-
.../tests/test_account_move_out_invoice.py | 4 -
addons/account/tests/test_payment_term.py | 169 +++++++++++++++---
.../views/account_payment_term_views.xml | 87 ++++-----
addons/account/views/report_invoice.xml | 8 +-
8 files changed, 270 insertions(+), 152 deletions(-)
diff --git a/addons/account/data/account_data.xml b/addons/account/data/account_data.xml
index a8b1fbb495e..b1189fca0df 100644
--- a/addons/account/data/account_data.xml
+++ b/addons/account/data/account_data.xml
@@ -37,49 +37,58 @@
Immediate PaymentPayment terms: Immediate Payment
+ 15 DaysPayment terms: 15 Days
-
+ 21 DaysPayment terms: 21 Days
-
+ 30 DaysPayment terms: 30 Days
-
+ 45 DaysPayment terms: 45 Days
-
+ 2 MonthsPayment terms: 2 Months
-
+ End of Following MonthPayment terms: End of Following Month
-
+
+
+
+
+ 30 days End of Month on the 10th
+ Payment terms: 30 days End of Month on the 10th
+ 30% Now, Balance 60 DaysPayment terms: 30% Now, Balance 60 Days
-
+
-
-
-
-
-
- of the month
-
-
-
-
-
account.payment.term.searchaccount.payment.term
@@ -87,21 +33,48 @@
diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml
index 343c88d6b65..ad7cf3f6284 100644
--- a/addons/account/views/report_invoice.xml
+++ b/addons/account/views/report_invoice.xml
@@ -201,7 +201,13 @@
Please use the following communication for your payment :