From dbabe2fdf304baced9fddb9dd14c94ddaf579b08 Mon Sep 17 00:00:00 2001
From: szalatyzuzanna
Date: Wed, 2 Oct 2024 21:13:58 +0200
Subject: [PATCH] [MIG] sale_transaction_form_link: Migration to 16.0
---
sale_transaction_form_link/README.rst | 12 ++-
sale_transaction_form_link/__manifest__.py | 2 +-
.../demo/payment_transaction.xml | 2 +-
.../readme/CONTRIBUTORS.rst | 2 +
.../static/description/index.html | 26 +++--
sale_transaction_form_link/tests/__init__.py | 1 +
.../tests/test_sale_order.py | 94 +++++++++++++++++++
7 files changed, 124 insertions(+), 15 deletions(-)
create mode 100644 sale_transaction_form_link/tests/__init__.py
create mode 100644 sale_transaction_form_link/tests/test_sale_order.py
diff --git a/sale_transaction_form_link/README.rst b/sale_transaction_form_link/README.rst
index 18e1ee35b1e..a7e9ecbe7f8 100644
--- a/sale_transaction_form_link/README.rst
+++ b/sale_transaction_form_link/README.rst
@@ -17,13 +17,13 @@ Sale Transaction Form Link
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/sale-workflow/tree/14.0/sale_transaction_form_link
+ :target: https://github.com/OCA/sale-workflow/tree/16.0/sale_transaction_form_link
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_transaction_form_link
+ :target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_transaction_form_link
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
- :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=14.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -51,7 +51,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -67,6 +67,8 @@ Contributors
~~~~~~~~~~~~
* Denis Roussel
+* `Binhex `_:
+ * Zuzanna Elzbieta Szalaty Szalaty
Maintainers
~~~~~~~~~~~
@@ -89,6 +91,6 @@ Current `maintainer `__:
|maintainer-rousseldenis|
-This module is part of the `OCA/sale-workflow `_ project on GitHub.
+This module is part of the `OCA/sale-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/sale_transaction_form_link/__manifest__.py b/sale_transaction_form_link/__manifest__.py
index 308e17acedd..1e63a66158c 100644
--- a/sale_transaction_form_link/__manifest__.py
+++ b/sale_transaction_form_link/__manifest__.py
@@ -5,7 +5,7 @@
"name": "Sale Transaction Form Link",
"summary": """
Allows to display a link to payment transactions on Sale Order form view.""",
- "version": "14.0.1.0.0",
+ "version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
diff --git a/sale_transaction_form_link/demo/payment_transaction.xml b/sale_transaction_form_link/demo/payment_transaction.xml
index f9d5006d8d0..a232c6357b2 100644
--- a/sale_transaction_form_link/demo/payment_transaction.xml
+++ b/sale_transaction_form_link/demo/payment_transaction.xml
@@ -3,7 +3,7 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
-
+
750.0
draft
diff --git a/sale_transaction_form_link/readme/CONTRIBUTORS.rst b/sale_transaction_form_link/readme/CONTRIBUTORS.rst
index 9179ee4b8fa..aa5ead80c81 100644
--- a/sale_transaction_form_link/readme/CONTRIBUTORS.rst
+++ b/sale_transaction_form_link/readme/CONTRIBUTORS.rst
@@ -1 +1,3 @@
* Denis Roussel
+* `Binhex `_:
+ * Zuzanna Elzbieta Szalaty Szalaty
\ No newline at end of file
diff --git a/sale_transaction_form_link/static/description/index.html b/sale_transaction_form_link/static/description/index.html
index 3ce1506515e..08a9930df8f 100644
--- a/sale_transaction_form_link/static/description/index.html
+++ b/sale_transaction_form_link/static/description/index.html
@@ -1,4 +1,3 @@
-
@@ -9,10 +8,11 @@
/*
:Author: David Goodger (goodger@python.org)
-:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
+:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
+Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }
-pre.code .ln { color: grey; } /* line numbers */
+pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +301,7 @@
span.pre {
white-space: pre }
-span.problematic {
+span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@@ -369,7 +369,7 @@ Sale Transaction Form Link
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:eef924cb9222cf85856ffa5669609f15be9c49ba827dc1d0f964ea10302dea60
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
![Try me on Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)
+
![Try me on Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)
- This module adds a button on Sale Order Form in order to see all the payment
transactions related to that Sale Order.
@@ -401,7 +401,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
This module is maintained by the OCA.
-
![Odoo Community Association](https://odoo-community.org/logo.png)
+
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
Current maintainer:
![rousseldenis](https://github.com/rousseldenis.png?size=40px)
-
This module is part of the OCA/sale-workflow project on GitHub.
+
This module is part of the OCA/sale-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/sale_transaction_form_link/tests/__init__.py b/sale_transaction_form_link/tests/__init__.py
new file mode 100644
index 00000000000..6f699d0d8ba
--- /dev/null
+++ b/sale_transaction_form_link/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_sale_order
diff --git a/sale_transaction_form_link/tests/test_sale_order.py b/sale_transaction_form_link/tests/test_sale_order.py
new file mode 100644
index 00000000000..73cef104941
--- /dev/null
+++ b/sale_transaction_form_link/tests/test_sale_order.py
@@ -0,0 +1,94 @@
+# Copyright 2024 Binhex - Zuzanna Elzbieta Szalaty Szalaty.
+# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
+from odoo.tests.common import TransactionCase
+
+
+class TestSaleOrder(TransactionCase):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.partner_id = cls.env["res.partner"].create({"name": "Test Partner"})
+ cls.sale_order = cls.env["sale.order"].create(
+ {
+ "partner_id": cls.partner_id.id,
+ }
+ )
+ cls.provider = cls.env["payment.provider"].create(
+ {
+ "name": "Test",
+ "code": "none",
+ }
+ )
+
+ def test_compute_payment_transaction_count(self):
+ self.assertEqual(self.sale_order.payment_transaction_count, 0)
+ transaction1 = self.env["payment.transaction"].create(
+ {
+ "provider_id": self.provider.id,
+ "partner_id": self.partner_id.id,
+ "amount": 100,
+ "currency_id": self.env.company.currency_id.id,
+ }
+ )
+ transaction2 = self.env["payment.transaction"].create(
+ {
+ "provider_id": self.provider.id,
+ "partner_id": self.partner_id.id,
+ "amount": 200,
+ "currency_id": self.env.company.currency_id.id,
+ }
+ )
+ self.sale_order.transaction_ids = [transaction1.id, transaction2.id]
+ self.assertEqual(self.sale_order.payment_transaction_count, 2)
+ transaction1.unlink()
+ self.assertEqual(self.sale_order.payment_transaction_count, 1)
+
+ def test_action_view_transaction(self):
+ action = self.sale_order.action_view_transaction()
+ self.assertEqual(action["type"], "ir.actions.act_window")
+ self.assertEqual(action["name"], "Payment Transactions")
+ self.assertEqual(action["res_model"], "payment.transaction")
+ self.assertEqual(action["view_mode"], "tree,form")
+ self.assertEqual(action["domain"], [("id", "in", [])])
+
+ transaction = self.env["payment.transaction"].create(
+ {
+ "provider_id": self.provider.id,
+ "partner_id": self.partner_id.id,
+ "amount": 100,
+ "currency_id": self.env.company.currency_id.id,
+ }
+ )
+ self.sale_order.transaction_ids = [transaction.id]
+ action = self.sale_order.action_view_transaction()
+ self.assertEqual(action["type"], "ir.actions.act_window")
+ self.assertEqual(action["name"], "Payment Transactions")
+ self.assertEqual(action["res_model"], "payment.transaction")
+ self.assertEqual(action["view_mode"], "form")
+ self.assertEqual(action["res_id"], transaction.id)
+
+ transaction1 = self.env["payment.transaction"].create(
+ {
+ "provider_id": self.provider.id,
+ "partner_id": self.partner_id.id,
+ "amount": 100,
+ "currency_id": self.env.company.currency_id.id,
+ }
+ )
+ transaction2 = self.env["payment.transaction"].create(
+ {
+ "provider_id": self.provider.id,
+ "partner_id": self.partner_id.id,
+ "amount": 200,
+ "currency_id": self.env.company.currency_id.id,
+ }
+ )
+ self.sale_order.transaction_ids = [transaction1.id, transaction2.id]
+ action = self.sale_order.action_view_transaction()
+ self.assertEqual(action["type"], "ir.actions.act_window")
+ self.assertEqual(action["name"], "Payment Transactions")
+ self.assertEqual(action["res_model"], "payment.transaction")
+ self.assertEqual(action["view_mode"], "tree,form")
+ self.assertEqual(
+ action["domain"], [("id", "in", [transaction1.id, transaction2.id])]
+ )