diff --git a/README.md b/README.md
index 66aec3278..5c3628baf 100644
--- a/README.md
+++ b/README.md
@@ -24,14 +24,14 @@ addon | version | maintainers | summary
[account_credit_control](account_credit_control/) | 18.0.2.0.2 | | Account Credit Control
[account_credit_control_attach_invoice](account_credit_control_attach_invoice/) | 18.0.1.0.0 | | Extend account credit control to print credit control summary with invoices
[account_credit_control_queue_job](account_credit_control_queue_job/) | 18.0.2.0.0 | | Account Credit Control
-[account_financial_risk](account_financial_risk/) | 18.0.1.2.0 |
| Manage customer risk
+[account_financial_risk](account_financial_risk/) | 18.0.1.2.1 |
| Manage customer risk
[account_invoice_overdue_reminder](account_invoice_overdue_reminder/) | 18.0.1.4.0 |
| Simple mail/letter/phone overdue customer invoice reminder
[account_invoice_overdue_warn](account_invoice_overdue_warn/) | 18.0.1.0.0 |
| Show warning on customer form view if it has overdue invoices
[account_invoice_overdue_warn_sale](account_invoice_overdue_warn_sale/) | 18.0.1.0.0 |
| Show overdue warning on sale order form view
[account_payment_return_financial_risk](account_payment_return_financial_risk/) | 18.0.1.0.0 | | Partner Payment Return Risk
[partner_risk_insurance](partner_risk_insurance/) | 18.0.1.0.3 |
| Risk insurance partner information
[partner_risk_insurance_product_sticker_invoice_report](partner_risk_insurance_product_sticker_invoice_report/) | 18.0.1.0.1 |
| Display a Sticker on Invoice Reports secured with Risk Insurance
-[sale_financial_risk](sale_financial_risk/) | 18.0.1.0.7 | | Manage partner risk in sales orders
+[sale_financial_risk](sale_financial_risk/) | 18.0.1.0.8 | | Manage partner risk in sales orders
[sale_financial_risk_info](sale_financial_risk_info/) | 18.0.1.0.1 | | Adds risk consumption info in sales orders.
[sale_payment_sheet_financial_risk](sale_payment_sheet_financial_risk/) | 18.0.1.0.0 | | Manage partner risk in sale payment sheet
[stock_financial_risk](stock_financial_risk/) | 18.0.1.0.0 | | Manage partner risk in stock moves
diff --git a/account_financial_risk/README.rst b/account_financial_risk/README.rst
index 73b2c9748..b3330a053 100644
--- a/account_financial_risk/README.rst
+++ b/account_financial_risk/README.rst
@@ -11,7 +11,7 @@ Account Financial Risk
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:35ca8aa706fb807506b68e0b2daf27815f218172f612b210306360785ea41e92
+ !! source digest: sha256:afe6d1cfbe9ba49246b36b462f278685d6b2d2f1615fe43de83e02e4de9597c8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
diff --git a/account_financial_risk/__manifest__.py b/account_financial_risk/__manifest__.py
index 48ecb9344..406db1bd7 100644
--- a/account_financial_risk/__manifest__.py
+++ b/account_financial_risk/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Account Financial Risk",
"summary": "Manage customer risk",
- "version": "18.0.1.2.0",
+ "version": "18.0.1.2.1",
"category": "Accounting",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
diff --git a/account_financial_risk/static/description/index.html b/account_financial_risk/static/description/index.html
index 18a72af34..79edbfcb8 100644
--- a/account_financial_risk/static/description/index.html
+++ b/account_financial_risk/static/description/index.html
@@ -372,7 +372,7 @@
Adds a new page in partner to manage its Financial Risk. (Only visible diff --git a/account_financial_risk/tests/test_account_financial_risk.py b/account_financial_risk/tests/test_account_financial_risk.py index 3d6ae7a54..98d61528c 100644 --- a/account_financial_risk/tests/test_account_financial_risk.py +++ b/account_financial_risk/tests/test_account_financial_risk.py @@ -2,6 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from dateutil.relativedelta import relativedelta +from freezegun import freeze_time from odoo import Command, fields from odoo.exceptions import UserError @@ -9,6 +10,7 @@ from odoo.addons.base.tests.common import BaseCommon +@freeze_time("2024-01-15 12:00:00") class TestPartnerFinancialRisk(BaseCommon): @classmethod def setUpClass(cls): @@ -104,6 +106,13 @@ def setUpClass(cls): ) ) cls.env.user.lang = False + # Use the same "today" reference _max_risk_date_due() itself + # compares against (context_today(), timezone-aware) rather than + # the naive Date.today() - with time frozen above this doesn't + # change which day either resolves to, but it keeps the test + # exercising the exact same date computation the module uses + # instead of one that merely happens to agree with it right now. + cls.today = fields.Date.context_today(cls.env.user) def test_invoices(self): self.partner.risk_invoice_draft_include = True @@ -134,7 +143,7 @@ def test_invoices(self): unrisk_partners = self.partner.search([("risk_exception", "=", False)]) self.assertIn(self.partner, unrisk_partners) self.partner.risk_invoice_open_limit = 300.0 - invoice2.invoice_date_due = fields.Date.today() + invoice2.invoice_date_due = self.today wiz_dic = invoice2.action_post() wiz = self.env[wiz_dic["res_model"]].browse(wiz_dic["res_id"]) self.assertEqual( @@ -152,7 +161,7 @@ def test_invoices(self): self.assertAlmostEqual(self.partner.risk_invoice_open, 0.0) wiz.button_continue() # HACK: Force the maturity date for not having an error here - invoice2.line_ids.write({"date_maturity": fields.Date.today()}) + invoice2.line_ids.write({"date_maturity": self.today}) self.assertAlmostEqual(self.partner.risk_invoice_open, 550.0) self.assertTrue(self.partner.risk_allow_edit) @@ -163,7 +172,7 @@ def test_other_account_amount(self): .create( { "journal_id": self.journal_sale.id, - "date": fields.Date.today(), + "date": self.today, "line_ids": [ Command.create( { @@ -191,7 +200,7 @@ def test_other_account_amount(self): line.date_maturity = "2017-01-01" self.assertAlmostEqual(self.partner.risk_account_amount, 0.0) self.assertAlmostEqual(self.partner.risk_account_amount_unpaid, 100.0) - line.date_maturity = fields.Date.today() - relativedelta(days=2) + line.date_maturity = self.today - relativedelta(days=2) self.assertAlmostEqual(self.partner.risk_account_amount, 0.0) self.assertAlmostEqual(self.partner.risk_account_amount_unpaid, 100.0) line.company_id.invoice_unpaid_margin = 3 diff --git a/sale_financial_risk/README.rst b/sale_financial_risk/README.rst index 083e30c04..ec0d1b92b 100644 --- a/sale_financial_risk/README.rst +++ b/sale_financial_risk/README.rst @@ -11,7 +11,7 @@ Sale Financial Risk !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:cff17e58f0a237f8853780958db9fdb297034b72987acef5e0177fdcde937529 + !! source digest: sha256:855b38feb350e134064f1bc35bd9c0ca5c61ab67a6e4a557cad73a03435b343c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/sale_financial_risk/__manifest__.py b/sale_financial_risk/__manifest__.py index dc782497c..27dbbab5f 100644 --- a/sale_financial_risk/__manifest__.py +++ b/sale_financial_risk/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Financial Risk", "summary": "Manage partner risk in sales orders", - "version": "18.0.1.0.7", + "version": "18.0.1.0.8", "category": "Sales Management", "license": "AGPL-3", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/sale_financial_risk/static/description/index.html b/sale_financial_risk/static/description/index.html index b32987966..137b1296e 100644 --- a/sale_financial_risk/static/description/index.html +++ b/sale_financial_risk/static/description/index.html @@ -372,7 +372,7 @@
Extends Partner Financial Risk to manage sales orders.
diff --git a/sale_financial_risk/tests/test_payment_financial_risk.py b/sale_financial_risk/tests/test_payment_financial_risk.py index 7392a11e6..30a127f0d 100644 --- a/sale_financial_risk/tests/test_payment_financial_risk.py +++ b/sale_financial_risk/tests/test_payment_financial_risk.py @@ -57,6 +57,18 @@ def test_payment_risk_bypass(self): """When the order confirmation come from a payment authorization the risk is bypassed. This is a trimmed version of sale/tests/test_11_so_payment_link to easily test that case""" + # /payment/pay (PaymentHttpCommon._get_portal_pay_context(), used + # below) is a website=True route (odoo/addons/payment/controllers/ + # portal.py) - it 404s unless the website module is installed, even + # though neither this module nor its declared dependencies + # (sale, account_financial_risk) require it. Skip rather than fail + # on an install that deliberately doesn't carry website. + if ( + not self.env["ir.module.module"] + .sudo() + .search_count([("name", "=", "website"), ("state", "=", "installed")]) + ): + self.skipTest("website is not installed") # Force risk exception to whatever amount self.assertFalse(self.partner.risk_exception) self.amount = self.order.amount_total