Skip to content

Commit

Permalink
[IMP] sale_elaboration: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
peluko00 committed Aug 20, 2024
1 parent 18b1e5e commit d60116e
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 78 deletions.
65 changes: 33 additions & 32 deletions sale_elaboration/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand All @@ -46,56 +47,56 @@ 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
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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 <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_elaboration%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_elaboration%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~
-------

* Tecnativa

Contributors
~~~~~~~~~~~~
------------

* `Tecnativa <https://www.tecnativa.com>`_:
- `Tecnativa <https://www.tecnativa.com>`__:

* Sergio Teruel
* Pedro M. Baeza
* Carlos Roca
* Ernesto Tejeda
- Sergio Teruel
- Pedro M. Baeza
- Carlos Roca
- Ernesto Tejeda

* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__)
- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
- Jairo Llopis (`Moduon <https://www.moduon.team/>`__)

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand Down Expand Up @@ -124,6 +125,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-CarlosRoca13| |maintainer-rafaelbn| |maintainer-sergio-teruel| |maintainer-yajo|

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_elaboration>`_ project on GitHub.
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/17.0/sale_elaboration>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions sale_elaboration/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down
2 changes: 1 addition & 1 deletion sale_elaboration/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions sale_elaboration/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
6 changes: 6 additions & 0 deletions sale_elaboration/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 0 additions & 6 deletions sale_elaboration/readme/CONFIGURE.rst

This file was deleted.

7 changes: 7 additions & 0 deletions sale_elaboration/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -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/))
9 changes: 0 additions & 9 deletions sale_elaboration/readme/CONTRIBUTORS.rst

This file was deleted.

8 changes: 8 additions & 0 deletions sale_elaboration/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 0 additions & 7 deletions sale_elaboration/readme/DESCRIPTION.rst

This file was deleted.

8 changes: 8 additions & 0 deletions sale_elaboration/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 0 additions & 8 deletions sale_elaboration/readme/USAGE.rst

This file was deleted.

21 changes: 11 additions & 10 deletions sale_elaboration/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,14 @@ <h1 class="title">Sale Elaboration</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:fb2acb1d933040120f2642c0747e4f7f34761bd5bcd9c833c38e4615333e1fda
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/16.0/sale_elaboration"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_elaboration"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_elaboration"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_elaboration"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p>An <strong>elaboration</strong> 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.</p>
elaboration on lines that will add an extra order line with an
elaboration product linked to it when the delivery order is validated.</p>
<p>An <strong>elaboration</strong> 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.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand Down Expand Up @@ -408,16 +409,16 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<li>Select an elaboration in the line.</li>
<li>Confirm the sales order.</li>
<li>Go to the picking created by this sales order and validate it.</li>
<li>Go back to the sales order. A new line is created with the product linked to
the elaboration.</li>
<li>Go back to the sales order. A new line is created with the product
linked to the elaboration.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_elaboration%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_elaboration%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -451,7 +452,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/CarlosRoca13"><img alt="CarlosRoca13" src="https://github.com/CarlosRoca13.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/rafaelbn"><img alt="rafaelbn" src="https://github.com/rafaelbn.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/yajo"><img alt="yajo" src="https://github.com/yajo.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/16.0/sale_elaboration">OCA/sale-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_elaboration">OCA/sale-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions sale_elaboration/tests/test_sale_elaboration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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):
Expand Down

0 comments on commit d60116e

Please sign in to comment.