Skip to content

Commit 57b185b

Browse files
[IMP] delivery_estimated_package_quantity_by_weight: pre-commit auto fixes
1 parent 9e1cf40 commit 57b185b

14 files changed

+103
-109
lines changed

delivery_estimated_package_quantity_by_weight/README.rst

+26-24
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,33 @@ Delivery Estimated Package Quantity By Weight
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github
20-
:target: https://github.com/OCA/delivery-carrier/tree/16.0/delivery_estimated_package_quantity_by_weight
20+
:target: https://github.com/OCA/delivery-carrier/tree/18.0/delivery_estimated_package_quantity_by_weight
2121
:alt: OCA/delivery-carrier
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-0-delivery_estimated_package_quantity_by_weight
23+
:target: https://translation.odoo-community.org/projects/delivery-carrier-18-0/delivery-carrier-18-0-delivery_estimated_package_quantity_by_weight
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

3131
This module computes the amount of packages a picking out should have
32-
depending on the weight of the products and the limit fixed by the carrier.
33-
It's fully independent of the delivery_package_number module.
32+
depending on the weight of the products and the limit fixed by the
33+
carrier. It's fully independent of the delivery_package_number module.
3434

35-
A warning is given if the number of packages for the picking out is above what
36-
is considered as the theoretical number of packages for this picking and the
37-
chosen carrier. The goal is to minimize the number of packages billed by the
38-
carrier.
35+
A warning is given if the number of packages for the picking out is
36+
above what is considered as the theoretical number of packages for this
37+
picking and the chosen carrier. The goal is to minimize the number of
38+
packages billed by the carrier.
3939

4040
The chosen strategy for the theoretical number of packages is as follow:
41-
* Split the product_weights into as many items as we have
42-
* Try to fit the heaviest product with the lightest.
43-
If it does not work then the heaviest should have a box for itself
44-
* While the weight of products does not exceed the limit, continue adding
45-
products in the same package
41+
42+
- Split the product_weights into as many items as we have
43+
- Try to fit the heaviest product with the lightest. If it does not work
44+
then the heaviest should have a box for itself
45+
- While the weight of products does not exceed the limit, continue
46+
adding products in the same package
4647

4748
**Table of contents**
4849

@@ -53,36 +54,37 @@ Usage
5354
=====
5455

5556
Here are some limitations of the module:
56-
* Product packagings are not supported
57-
* Multiple package types having different max weight for a shipping method
58-
are not supported
57+
58+
- Product packagings are not supported
59+
- Multiple package types having different max weight for a shipping
60+
method are not supported
5961

6062
Bug Tracker
6163
===========
6264

6365
Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/issues>`_.
6466
In case of trouble, please check there if your issue has already been reported.
6567
If you spotted it first, help us to smash it by providing a detailed and welcomed
66-
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_estimated_package_quantity_by_weight%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
68+
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_estimated_package_quantity_by_weight%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6769

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

7072
Credits
7173
=======
7274

7375
Authors
74-
~~~~~~~
76+
-------
7577

7678
* ACSONE SA/NV
7779

7880
Contributors
79-
~~~~~~~~~~~~
81+
------------
8082

81-
* Lindsay Marion <lindsay.marion@acsone.eu>
82-
* Hughes Damry <hughes.damry@acsone.eu>
83+
- Lindsay Marion <lindsay.marion@acsone.eu>
84+
- Hughes Damry <hughes.damry@acsone.eu>
8385

8486
Maintainers
85-
~~~~~~~~~~~
87+
-----------
8688

8789
This module is maintained by the OCA.
8890

@@ -94,6 +96,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9496
mission is to support the collaborative development of Odoo features and
9597
promote its widespread use.
9698

97-
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/16.0/delivery_estimated_package_quantity_by_weight>`_ project on GitHub.
99+
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/18.0/delivery_estimated_package_quantity_by_weight>`_ project on GitHub.
98100

99101
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

delivery_estimated_package_quantity_by_weight/models/delivery_carrier.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class DeliveryCarrier(models.Model):
8-
98
_inherit = "delivery.carrier"
109

1110
maximum_weight_per_package = fields.Float(string="Maximum weight per package")

delivery_estimated_package_quantity_by_weight/models/stock_picking.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class StockPicking(models.Model):
8-
98
_inherit = "stock.picking"
109

1110
theoretical_number_of_packages = fields.Integer(
@@ -29,7 +28,6 @@ class StockPicking(models.Model):
2928
"picking_type_code", "carrier_id", "carrier_id.maximum_weight_per_package"
3029
)
3130
def _compute_is_number_of_packages_visible(self):
32-
3331
for rec in self:
3432
if (
3533
rec.picking_type_code == "outgoing"
@@ -80,10 +78,9 @@ def _compute_is_number_of_packages_outranged(self):
8078
def _number_of_packages(
8179
self, products_weights, number_of_items, maximum_weight_per_package
8280
):
83-
8481
# Split the product_weights into as many items as we haves
8582
products_weights_list = []
86-
for weight, number in zip(products_weights, number_of_items):
83+
for weight, number in zip(products_weights, number_of_items, strict=False):
8784
for _i in range(int(number)):
8885
products_weights_list.append(weight)
8986

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Lindsay Marion \<<lindsay.marion@acsone.eu>\>
2+
- Hughes Damry \<<hughes.damry@acsone.eu>\>

delivery_estimated_package_quantity_by_weight/readme/CONTRIBUTORS.rst

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
This module computes the amount of packages a picking out should have
2+
depending on the weight of the products and the limit fixed by the
3+
carrier. It's fully independent of the delivery_package_number module.
4+
5+
A warning is given if the number of packages for the picking out is
6+
above what is considered as the theoretical number of packages for this
7+
picking and the chosen carrier. The goal is to minimize the number of
8+
packages billed by the carrier.
9+
10+
The chosen strategy for the theoretical number of packages is as follow:
11+
- Split the product_weights into as many items as we have
12+
- Try to fit the heaviest product with the lightest. If it does not work
13+
then the heaviest should have a box for itself
14+
- While the weight of products does not exceed the limit, continue
15+
adding products in the same package

delivery_estimated_package_quantity_by_weight/readme/DESCRIPTION.rst

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Here are some limitations of the module:
2+
- Product packagings are not supported
3+
- Multiple package types having different max weight for a shipping
4+
method are not supported

delivery_estimated_package_quantity_by_weight/readme/USAGE.rst

-4
This file was deleted.

delivery_estimated_package_quantity_by_weight/static/description/index.html

+26-30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
43
<head>
@@ -9,10 +8,11 @@
98

109
/*
1110
:Author: David Goodger (goodger@python.org)
12-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1312
:Copyright: This stylesheet has been placed in the public domain.
1413
1514
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1616
1717
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
@@ -275,7 +275,7 @@
275275
margin-left: 2em ;
276276
margin-right: 2em }
277277

278-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
279279
pre.code, code { background-color: #eeeeee }
280280
pre.code .comment, code .comment { color: #5C6576 }
281281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +301,7 @@
301301
span.pre {
302302
white-space: pre }
303303

304-
span.problematic {
304+
span.problematic, pre.problematic {
305305
color: red }
306306

307307
span.section-subtitle {
@@ -369,25 +369,22 @@ <h1 class="title">Delivery Estimated Package Quantity By Weight</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:a35ba2d1b127f3f76257bb0405764911e2b224b554865a756261c6f221cbe3de
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<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_estimated_package_quantity_by_weight"><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_estimated_package_quantity_by_weight"><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>
372+
<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/18.0/delivery_estimated_package_quantity_by_weight"><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-18-0/delivery-carrier-18-0-delivery_estimated_package_quantity_by_weight"><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=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module computes the amount of packages a picking out should have
374-
depending on the weight of the products and the limit fixed by the carrier.
375-
It’s fully independent of the delivery_package_number module.</p>
376-
<p>A warning is given if the number of packages for the picking out is above what
377-
is considered as the theoretical number of packages for this picking and the
378-
chosen carrier. The goal is to minimize the number of packages billed by the
379-
carrier.</p>
380-
<dl class="docutils">
381-
<dt>The chosen strategy for the theoretical number of packages is as follow:</dt>
382-
<dd><ul class="first last simple">
374+
depending on the weight of the products and the limit fixed by the
375+
carrier. It’s fully independent of the delivery_package_number module.</p>
376+
<p>A warning is given if the number of packages for the picking out is
377+
above what is considered as the theoretical number of packages for this
378+
picking and the chosen carrier. The goal is to minimize the number of
379+
packages billed by the carrier.</p>
380+
<p>The chosen strategy for the theoretical number of packages is as follow:</p>
381+
<ul class="simple">
383382
<li>Split the product_weights into as many items as we have</li>
384-
<li>Try to fit the heaviest product with the lightest.
385-
If it does not work then the heaviest should have a box for itself</li>
386-
<li>While the weight of products does not exceed the limit, continue adding
387-
products in the same package</li>
383+
<li>Try to fit the heaviest product with the lightest. If it does not work
384+
then the heaviest should have a box for itself</li>
385+
<li>While the weight of products does not exceed the limit, continue
386+
adding products in the same package</li>
388387
</ul>
389-
</dd>
390-
</dl>
391388
<p><strong>Table of contents</strong></p>
392389
<div class="contents local topic" id="contents">
393390
<ul class="simple">
@@ -403,22 +400,19 @@ <h1 class="title">Delivery Estimated Package Quantity By Weight</h1>
403400
</div>
404401
<div class="section" id="usage">
405402
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
406-
<dl class="docutils">
407-
<dt>Here are some limitations of the module:</dt>
408-
<dd><ul class="first last simple">
403+
<p>Here are some limitations of the module:</p>
404+
<ul class="simple">
409405
<li>Product packagings are not supported</li>
410-
<li>Multiple package types having different max weight for a shipping method
411-
are not supported</li>
406+
<li>Multiple package types having different max weight for a shipping
407+
method are not supported</li>
412408
</ul>
413-
</dd>
414-
</dl>
415409
</div>
416410
<div class="section" id="bug-tracker">
417411
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
418412
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/delivery-carrier/issues">GitHub Issues</a>.
419413
In case of trouble, please check there if your issue has already been reported.
420414
If you spotted it first, help us to smash it by providing a detailed and welcomed
421-
<a class="reference external" href="https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_estimated_package_quantity_by_weight%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
415+
<a class="reference external" href="https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_estimated_package_quantity_by_weight%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
422416
<p>Do not contact contributors directly about support or help with technical issues.</p>
423417
</div>
424418
<div class="section" id="credits">
@@ -439,11 +433,13 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
439433
<div class="section" id="maintainers">
440434
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
441435
<p>This module is maintained by the OCA.</p>
442-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
436+
<a class="reference external image-reference" href="https://odoo-community.org">
437+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
438+
</a>
443439
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
444440
mission is to support the collaborative development of Odoo features and
445441
promote its widespread use.</p>
446-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/16.0/delivery_estimated_package_quantity_by_weight">OCA/delivery-carrier</a> project on GitHub.</p>
442+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/delivery-carrier/tree/18.0/delivery_estimated_package_quantity_by_weight">OCA/delivery-carrier</a> project on GitHub.</p>
447443
<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>
448444
</div>
449445
</div>

delivery_estimated_package_quantity_by_weight/tests/test_stock_picking.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ def test_all_products(self):
220220
Data:
221221
All the products are in the SO, some are heavy, others light
222222
Test case:
223-
Check the number of packages in the shipping. Each box should not exceed 37 kg
223+
Check the number of packages in the shipping.
224+
Each box should not exceed 37 kg
224225
We have a lot of products in this shipping:
225226
10 product1 with weight of 25kg each => 250kg
226227
10 product2 with weight of 30kg each => 300kg

delivery_estimated_package_quantity_by_weight/views/delivery_carrier_views.xml

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<!-- Copyright 2021 ACSONE SA/NV
33
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
44
<odoo>
5-
65
<record model="ir.ui.view" id="delivery_carrier_form_view">
76
<field
87
name="name"
@@ -11,11 +10,11 @@
1110
<field name="inherit_id" ref="delivery.view_delivery_carrier_form" />
1211
<field name="arch" type="xml">
1312
<field name="integration_level" position="before">
14-
<label for="maximum_weight_per_package" />
15-
<div class="o_row" name="maximum_weight_per_package">
16-
<field name="maximum_weight_per_package" class="oe_inline" />
17-
<field name="weight_uom_name" />
18-
</div>
13+
<label for="maximum_weight_per_package" />
14+
<div class="o_row" name="maximum_weight_per_package">
15+
<field name="maximum_weight_per_package" class="oe_inline" />
16+
<field name="weight_uom_name" />
17+
</div>
1918
</field>
2019
</field>
2120
</record>
@@ -31,5 +30,4 @@
3130
</field>
3231
</field>
3332
</record>
34-
3533
</odoo>

0 commit comments

Comments
 (0)