Skip to content

Commit

Permalink
[IMP] delivery_package_number: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Josep-s73 authored and pablo-cort-s73 committed Nov 26, 2024
1 parent 1964e5f commit 47aaaa7
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 72 deletions.
58 changes: 31 additions & 27 deletions delivery_package_number/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@ Stock Picking Package Number
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github
:target: https://github.com/OCA/delivery-carrier/tree/16.0/delivery_package_number
:target: https://github.com/OCA/delivery-carrier/tree/17.0/delivery_package_number
:alt: OCA/delivery-carrier
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-0-delivery_package_number
:target: https://translation.odoo-community.org/projects/delivery-carrier-17-0/delivery-carrier-17-0-delivery_package_number
: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/delivery-carrier&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module recovers the number of packages field that was present in previous
versions of Odoo, that can be either be set manually by the user, but also allows
to be computed when the delivery packages flow is used.
This module recovers the number of packages field that was present in
previous versions of Odoo, that can be either be set manually by the
user, but also allows to be computed when the delivery packages flow is
used.

This field can be used by delivery carrier extensions that need such info to
rate the shipment, print the labels, etc.
This field can be used by delivery carrier extensions that need such
info to rate the shipment, print the labels, etc.

**Table of contents**

Expand All @@ -45,53 +46,56 @@ Usage

If no delivery packages are used:

#. Go to an open picking and click in the *Additional Info* tab.
#. In the *Delivey Information* section you'll find a **Number of packages**
field that you can edit.
1. Go to an open picking and click in the *Additional Info* tab.
2. In the *Delivey Information* section you'll find a **Number of
packages** field that you can edit.

If delivey packages are used:

#. The field will be recomputed depending on the delivery packages used in the
picking although can be edited at convenience later.
1. The field will be recomputed depending on the delivery packages used
in the picking although can be edited at convenience later.

When the picking is confirmed, the user has the chance to change the number of
packages in the confirmation wizard.
When the picking is confirmed, the user has the chance to change the
number of packages in the confirmation wizard.

Bug Tracker
===========

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

* Pedro M. Baeza
* David Vidal
* Carlos Roca
* Sergio Teruel
- Pedro M. Baeza
- David Vidal
- Marçal Isern
- Carlos Roca

..
- `Sygel <https://www.sygel.es>`__:

* `Sygel <https://www.sygel.es>`_:
..
* Ángel García de la Chica Herrera <[email protected]>
- Ángel García de la Chica Herrera <[email protected]>

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

This module is maintained by the OCA.

Expand All @@ -103,6 +107,6 @@ 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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion delivery_package_number/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Stock Picking Package Number",
"summary": "Set or compute number of packages for a picking",
"version": "16.0.2.0.0",
"version": "17.0.1.0.0",
"category": "Delivery",
"website": "https://github.com/OCA/delivery-carrier",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
3 changes: 3 additions & 0 deletions delivery_package_number/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
9 changes: 9 additions & 0 deletions delivery_package_number/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- [Tecnativa](https://www.tecnativa.com):
- Pedro M. Baeza
- David Vidal
- Marçal Isern
- Carlos Roca

> - [Sygel](https://www.sygel.es):
>
> > - Ángel García de la Chica Herrera \<<[email protected]>\>
7 changes: 7 additions & 0 deletions delivery_package_number/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module recovers the number of packages field that was present in
previous versions of Odoo, that can be either be set manually by the
user, but also allows to be computed when the delivery packages flow is
used.

This field can be used by delivery carrier extensions that need such
info to rate the shipment, print the labels, etc.
6 changes: 0 additions & 6 deletions delivery_package_number/readme/DESCRIPTION.rst

This file was deleted.

13 changes: 13 additions & 0 deletions delivery_package_number/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
If no delivery packages are used:

1. Go to an open picking and click in the *Additional Info* tab.
2. In the *Delivey Information* section you'll find a **Number of
packages** field that you can edit.

If delivey packages are used:

1. The field will be recomputed depending on the delivery packages used
in the picking although can be edited at convenience later.

When the picking is confirmed, the user has the chance to change the
number of packages in the confirmation wizard.
13 changes: 0 additions & 13 deletions delivery_package_number/readme/USAGE.rst

This file was deleted.

42 changes: 24 additions & 18 deletions delivery_package_number/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
: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.
Expand Down Expand Up @@ -274,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 }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,12 +369,13 @@ <h1 class="title">Stock Picking Package Number</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ed46611ca917cfcfcc9384c072670a850ececadcfc52b66b2d5fb5f9a404f5b6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/delivery-carrier/tree/16.0/delivery_package_number"><img alt="OCA/delivery-carrier" src="https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-0-delivery_package_number"><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/delivery-carrier&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>This module recovers the number of packages field that was present in previous
versions of Odoo, that can be either be set manually by the user, but also allows
to be computed when the delivery packages flow is used.</p>
<p>This field can be used by delivery carrier extensions that need such info to
rate the shipment, print the labels, etc.</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/delivery-carrier/tree/17.0/delivery_package_number"><img alt="OCA/delivery-carrier" src="https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/delivery-carrier-17-0/delivery-carrier-17-0-delivery_package_number"><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/delivery-carrier&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 recovers the number of packages field that was present in
previous versions of Odoo, that can be either be set manually by the
user, but also allows to be computed when the delivery packages flow is
used.</p>
<p>This field can be used by delivery carrier extensions that need such
info to rate the shipment, print the labels, etc.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -392,23 +394,23 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>If no delivery packages are used:</p>
<ol class="arabic simple">
<li>Go to an open picking and click in the <em>Additional Info</em> tab.</li>
<li>In the <em>Delivey Information</em> section you’ll find a <strong>Number of packages</strong>
field that you can edit.</li>
<li>In the <em>Delivey Information</em> section you’ll find a <strong>Number of
packages</strong> field that you can edit.</li>
</ol>
<p>If delivey packages are used:</p>
<ol class="arabic simple">
<li>The field will be recomputed depending on the delivery packages used in the
picking although can be edited at convenience later.</li>
<li>The field will be recomputed depending on the delivery packages used
in the picking although can be edited at convenience later.</li>
</ol>
<p>When the picking is confirmed, the user has the chance to change the number of
packages in the confirmation wizard.</p>
<p>When the picking is confirmed, the user has the chance to change the
number of packages in the confirmation wizard.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/delivery-carrier/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/delivery-carrier/issues/new?body=module:%20delivery_package_number%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/delivery-carrier/issues/new?body=module:%20delivery_package_number%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 All @@ -430,10 +432,12 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</ul>
</li>
</ul>
<!-- -->
<blockquote>
<ul class="simple">
<li><a class="reference external" href="https://www.sygel.es">Sygel</a>:</li>
</ul>
<!-- -->
<blockquote>
<ul class="simple">
<li>Ángel García de la Chica Herrera &lt;<a class="reference external" href="mailto:angel.garcia&#64;sygel.es">angel.garcia&#64;sygel.es</a>&gt;</li>
Expand All @@ -444,11 +448,13 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/16.0/delivery_package_number">OCA/delivery-carrier</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/17.0/delivery_package_number">OCA/delivery-carrier</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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class StockBackorderConfirmation(models.TransientModel):
_inherit = "stock.backorder.confirmation"

def process(self):
# put context key for avoiding `base_delivery_carrier_label` auto-packaging feature
return super(
if self.number_of_packages:
self.pick_ids.write({"number_of_packages": self.number_of_packages})
# put context key for avoiding
# `base_delivery_carrier_label` auto-packaging feature
res = super(
StockBackorderConfirmation, self.with_context(set_default_package=False)
).process()
7 changes: 5 additions & 2 deletions delivery_package_number/wizard/stock_inmediate_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ class StockImmediateTransfer(models.TransientModel):
_inherit = "stock.immediate.transfer"

def process(self):
# put context key for avoiding `base_delivery_carrier_label` auto-packaging feature
return super(
if self.number_of_packages:
self.pick_ids.write({"number_of_packages": self.number_of_packages})
# put context key for avoiding
# `base_delivery_carrier_label` auto-packaging feature
res = super(
StockImmediateTransfer, self.with_context(set_default_package=False)
).process()
3 changes: 2 additions & 1 deletion delivery_package_number/wizard/stock_number_package_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class StockNumberPackageMixin(models.AbstractModel):
@api.depends("pick_ids")
def _compute_ask_number_of_packages(self):
for item in self:
# we use ._origin because if not, a NewId is used for the checks and the returned
# we use ._origin because if not,
# a NewId is used for the checks and the returned
# value of package_ids is wrong.
item.ask_number_of_packages = bool(
item.pick_ids.carrier_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def _compute_stock_number_package_validation_line_ids(self):
def process(self):
if self.number_of_packages:
self.pick_ids.write({"number_of_packages": self.number_of_packages})
# put context key for avoiding `base_delivery_carrier_label` auto-packaging feature
self.pick_ids.with_context(
# put context key for avoiding
# `base_delivery_carrier_label` auto-packaging feature
res = self.pick_ids.with_context(
set_default_package=False, bypass_set_number_of_packages=True
).button_validate()
if self.print_package_label:
Expand Down

0 comments on commit 47aaaa7

Please sign in to comment.