From d60116e4677152ca6bbaf4f7a0614472a2b74e44 Mon Sep 17 00:00:00 2001
From: Antoni Marroig Campomar
Date: Mon, 19 Aug 2024 15:37:56 +0200
Subject: [PATCH] [IMP] sale_elaboration: pre-commit auto fixes
---
sale_elaboration/README.rst | 65 ++++++++++---------
sale_elaboration/models/product_template.py | 4 +-
sale_elaboration/models/sale_order.py | 2 +-
sale_elaboration/pyproject.toml | 3 +
sale_elaboration/readme/CONFIGURE.md | 6 ++
sale_elaboration/readme/CONFIGURE.rst | 6 --
sale_elaboration/readme/CONTRIBUTORS.md | 7 ++
sale_elaboration/readme/CONTRIBUTORS.rst | 9 ---
sale_elaboration/readme/DESCRIPTION.md | 8 +++
sale_elaboration/readme/DESCRIPTION.rst | 7 --
sale_elaboration/readme/USAGE.md | 8 +++
sale_elaboration/readme/USAGE.rst | 8 ---
.../static/description/index.html | 21 +++---
.../tests/test_sale_elaboration.py | 6 +-
14 files changed, 82 insertions(+), 78 deletions(-)
create mode 100644 sale_elaboration/pyproject.toml
create mode 100644 sale_elaboration/readme/CONFIGURE.md
delete mode 100644 sale_elaboration/readme/CONFIGURE.rst
create mode 100644 sale_elaboration/readme/CONTRIBUTORS.md
delete mode 100644 sale_elaboration/readme/CONTRIBUTORS.rst
create mode 100644 sale_elaboration/readme/DESCRIPTION.md
delete mode 100644 sale_elaboration/readme/DESCRIPTION.rst
create mode 100644 sale_elaboration/readme/USAGE.md
delete mode 100644 sale_elaboration/readme/USAGE.rst
diff --git a/sale_elaboration/README.rst b/sale_elaboration/README.rst
index 6c2e6b30a28..b044f286e22 100644
--- a/sale_elaboration/README.rst
+++ b/sale_elaboration/README.rst
@@ -17,24 +17,25 @@ Sale Elaboration
: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/16.0/sale_elaboration
+ :target: https://github.com/OCA/sale-workflow/tree/17.0/sale_elaboration
: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-16-0/sale-workflow-16-0-sale_elaboration
+ :target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_elaboration
: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=16.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=17.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the functionality of sales orders to allow to set an
-elaboration on lines that will add an extra order line with an elaboration
-product linked to it when the delivery order is validated.
+elaboration on lines that will add an extra order line with an
+elaboration product linked to it when the delivery order is validated.
-An **elaboration** is a process that needs to be done over the product, usually
-on picking/handling phase. It doesn't modify too much the product for needing
-an specific product, but it adds a surcharge on the final price.
+An **elaboration** is a process that needs to be done over the product,
+usually on picking/handling phase. It doesn't modify too much the
+product for needing an specific product, but it adds a surcharge on the
+final price.
**Table of contents**
@@ -46,22 +47,22 @@ Configuration
To configure this module you need to:
-#. Go to *Sale > Configuration > Products > Sale Elaboration*.
-#. Create a new record.
-#. Set a product linked to the elaboration.
-#. Also you can select a route to procure this elaboration.
+1. Go to *Sale > Configuration > Products > Sale Elaboration*.
+2. Create a new record.
+3. Set a product linked to the elaboration.
+4. Also you can select a route to procure this elaboration.
Usage
=====
-#. Go to *Sale > Quotations*.
-#. Create a sales order.
-#. Add a new line.
-#. Select an elaboration in the line.
-#. Confirm the sales order.
-#. Go to the picking created by this sales order and validate it.
-#. Go back to the sales order. A new line is created with the product linked to
- the elaboration.
+1. Go to *Sale > Quotations*.
+2. Create a sales order.
+3. Add a new line.
+4. Select an elaboration in the line.
+5. Confirm the sales order.
+6. Go to the picking created by this sales order and validate it.
+7. Go back to the sales order. A new line is created with the product
+ linked to the elaboration.
Bug Tracker
===========
@@ -69,7 +70,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.
@@ -77,25 +78,25 @@ Credits
=======
Authors
-~~~~~~~
+-------
* Tecnativa
Contributors
-~~~~~~~~~~~~
+------------
-* `Tecnativa `_:
+- `Tecnativa `__:
- * Sergio Teruel
- * Pedro M. Baeza
- * Carlos Roca
- * Ernesto Tejeda
+ - Sergio Teruel
+ - Pedro M. Baeza
+ - Carlos Roca
+ - Ernesto Tejeda
-* Eduardo de Miguel (`Moduon `__)
-* Jairo Llopis (`Moduon `__)
+- Eduardo de Miguel (`Moduon `__)
+- Jairo Llopis (`Moduon `__)
Maintainers
-~~~~~~~~~~~
+-----------
This module is maintained by the OCA.
@@ -124,6 +125,6 @@ Current `maintainers `__:
|maintainer-CarlosRoca13| |maintainer-rafaelbn| |maintainer-sergio-teruel| |maintainer-yajo|
-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_elaboration/models/product_template.py b/sale_elaboration/models/product_template.py
index bd68832811a..fe9cc9bbc0f 100644
--- a/sale_elaboration/models/product_template.py
+++ b/sale_elaboration/models/product_template.py
@@ -33,9 +33,9 @@ def _inverse_elaboration_profile_id(self):
@api.model_create_multi
def create(self, vals_list):
- templates = super(ProductTemplate, self).create(vals_list)
+ templates = super().create(vals_list)
# This is needed to set given values to first variant after creation
- for template, vals in zip(templates, vals_list):
+ for template, vals in zip(templates, vals_list, strict=True):
if vals.get("elaboration_profile_id"):
template.write(
{"elaboration_profile_id": vals["elaboration_profile_id"]}
diff --git a/sale_elaboration/models/sale_order.py b/sale_elaboration/models/sale_order.py
index 68123539a9c..33e0fdd4e4f 100644
--- a/sale_elaboration/models/sale_order.py
+++ b/sale_elaboration/models/sale_order.py
@@ -86,7 +86,7 @@ def _compute_elaboration_price_unit(self):
def _prepare_invoice_line(self, **optional_values):
vals = super()._prepare_invoice_line(**optional_values)
if self.is_elaboration:
- vals["name"] = "{} - {}".format(self.order_id.name, self.name)
+ vals["name"] = f"{self.order_id.name} - {self.name}"
return vals
def _search_is_prepared(self, operator, value):
diff --git a/sale_elaboration/pyproject.toml b/sale_elaboration/pyproject.toml
new file mode 100644
index 00000000000..4231d0cccb3
--- /dev/null
+++ b/sale_elaboration/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["whool"]
+build-backend = "whool.buildapi"
diff --git a/sale_elaboration/readme/CONFIGURE.md b/sale_elaboration/readme/CONFIGURE.md
new file mode 100644
index 00000000000..305535001f6
--- /dev/null
+++ b/sale_elaboration/readme/CONFIGURE.md
@@ -0,0 +1,6 @@
+To configure this module you need to:
+
+1. Go to *Sale \> Configuration \> Products \> Sale Elaboration*.
+2. Create a new record.
+3. Set a product linked to the elaboration.
+4. Also you can select a route to procure this elaboration.
diff --git a/sale_elaboration/readme/CONFIGURE.rst b/sale_elaboration/readme/CONFIGURE.rst
deleted file mode 100644
index 319139264f4..00000000000
--- a/sale_elaboration/readme/CONFIGURE.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-To configure this module you need to:
-
-#. Go to *Sale > Configuration > Products > Sale Elaboration*.
-#. Create a new record.
-#. Set a product linked to the elaboration.
-#. Also you can select a route to procure this elaboration.
diff --git a/sale_elaboration/readme/CONTRIBUTORS.md b/sale_elaboration/readme/CONTRIBUTORS.md
new file mode 100644
index 00000000000..5187ae1e1c8
--- /dev/null
+++ b/sale_elaboration/readme/CONTRIBUTORS.md
@@ -0,0 +1,7 @@
+- [Tecnativa](https://www.tecnativa.com):
+ - Sergio Teruel
+ - Pedro M. Baeza
+ - Carlos Roca
+ - Ernesto Tejeda
+- Eduardo de Miguel ([Moduon](https://www.moduon.team/))
+- Jairo Llopis ([Moduon](https://www.moduon.team/))
diff --git a/sale_elaboration/readme/CONTRIBUTORS.rst b/sale_elaboration/readme/CONTRIBUTORS.rst
deleted file mode 100644
index 72499138503..00000000000
--- a/sale_elaboration/readme/CONTRIBUTORS.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-* `Tecnativa `_:
-
- * Sergio Teruel
- * Pedro M. Baeza
- * Carlos Roca
- * Ernesto Tejeda
-
-* Eduardo de Miguel (`Moduon `__)
-* Jairo Llopis (`Moduon `__)
diff --git a/sale_elaboration/readme/DESCRIPTION.md b/sale_elaboration/readme/DESCRIPTION.md
new file mode 100644
index 00000000000..b63b6c9dd15
--- /dev/null
+++ b/sale_elaboration/readme/DESCRIPTION.md
@@ -0,0 +1,8 @@
+This module extends the functionality of sales orders to allow to set an
+elaboration on lines that will add an extra order line with an
+elaboration product linked to it when the delivery order is validated.
+
+An **elaboration** is a process that needs to be done over the product,
+usually on picking/handling phase. It doesn't modify too much the
+product for needing an specific product, but it adds a surcharge on the
+final price.
diff --git a/sale_elaboration/readme/DESCRIPTION.rst b/sale_elaboration/readme/DESCRIPTION.rst
deleted file mode 100644
index 9b972169ca7..00000000000
--- a/sale_elaboration/readme/DESCRIPTION.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-This module extends the functionality of sales orders to allow to set an
-elaboration on lines that will add an extra order line with an elaboration
-product linked to it when the delivery order is validated.
-
-An **elaboration** is a process that needs to be done over the product, usually
-on picking/handling phase. It doesn't modify too much the product for needing
-an specific product, but it adds a surcharge on the final price.
diff --git a/sale_elaboration/readme/USAGE.md b/sale_elaboration/readme/USAGE.md
new file mode 100644
index 00000000000..5d205d1ac05
--- /dev/null
+++ b/sale_elaboration/readme/USAGE.md
@@ -0,0 +1,8 @@
+1. Go to *Sale \> Quotations*.
+2. Create a sales order.
+3. Add a new line.
+4. Select an elaboration in the line.
+5. Confirm the sales order.
+6. Go to the picking created by this sales order and validate it.
+7. Go back to the sales order. A new line is created with the product
+ linked to the elaboration.
diff --git a/sale_elaboration/readme/USAGE.rst b/sale_elaboration/readme/USAGE.rst
deleted file mode 100644
index 1dc2e2ccb27..00000000000
--- a/sale_elaboration/readme/USAGE.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-#. Go to *Sale > Quotations*.
-#. Create a sales order.
-#. Add a new line.
-#. Select an elaboration in the line.
-#. Confirm the sales order.
-#. Go to the picking created by this sales order and validate it.
-#. Go back to the sales order. A new line is created with the product linked to
- the elaboration.
diff --git a/sale_elaboration/static/description/index.html b/sale_elaboration/static/description/index.html
index 87dcdee3d0d..f8dec1e1292 100644
--- a/sale_elaboration/static/description/index.html
+++ b/sale_elaboration/static/description/index.html
@@ -368,13 +368,14 @@ Sale Elaboration
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:fb2acb1d933040120f2642c0747e4f7f34761bd5bcd9c833c38e4615333e1fda
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module extends the functionality of sales orders to allow to set an
-elaboration on lines that will add an extra order line with an elaboration
-product linked to it when the delivery order is validated.
-An elaboration is a process that needs to be done over the product, usually
-on picking/handling phase. It doesn’t modify too much the product for needing
-an specific product, but it adds a surcharge on the final price.
+elaboration on lines that will add an extra order line with an
+elaboration product linked to it when the delivery order is validated.
+An elaboration is a process that needs to be done over the product,
+usually on picking/handling phase. It doesn’t modify too much the
+product for needing an specific product, but it adds a surcharge on the
+final price.
Table of contents
@@ -408,8 +409,8 @@
- Select an elaboration in the line.
- Confirm the sales order.
- Go to the picking created by this sales order and validate it.
-- Go back to the sales order. A new line is created with the product linked to
-the elaboration.
+- Go back to the sales order. A new line is created with the product
+linked to the elaboration.
@@ -417,7 +418,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.
diff --git a/sale_elaboration/tests/test_sale_elaboration.py b/sale_elaboration/tests/test_sale_elaboration.py
index f7fc139a66d..2f389dff4c0 100644
--- a/sale_elaboration/tests/test_sale_elaboration.py
+++ b/sale_elaboration/tests/test_sale_elaboration.py
@@ -124,7 +124,7 @@ def test_invoice_elaboration(self):
]
)
self.order.order_line.filtered(
- lambda l: l.product_id == self.product_elaboration_B
+ lambda x: x.product_id == self.product_elaboration_B
).is_elaboration = False
self.order.action_confirm()
invoice = self.order._create_invoices()
@@ -138,11 +138,11 @@ def test_invoice_elaboration(self):
)
self.assertEqual(
inv_line_elaboration.name,
- "{} - {}".format(self.order.name, so_line_elaboration.name),
+ f"{self.order.name} - {so_line_elaboration.name}",
)
self.assertNotEqual(
inv_line_no_elaboration.name,
- "{} - {}".format(self.order.name, so_line_no_elaboration.name),
+ f"{self.order.name} - {so_line_no_elaboration.name}",
)
def test_sale_elaboration_change_product(self):