[IMP] stock_packaging_calculator: pre-commit auto fixes

This commit is contained in:
chien
2024-06-10 14:51:36 +07:00
parent 8abac2a017
commit 71d6610abb
11 changed files with 96 additions and 88 deletions

View File

@@ -17,18 +17,19 @@ Stock packaging calculator
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_packaging_calculator
:target: https://github.com/OCA/stock-logistics-warehouse/tree/17.0/stock_packaging_calculator
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_packaging_calculator
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-17-0/stock-logistics-warehouse-17-0-stock_packaging_calculator
: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/stock-logistics-warehouse&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=17.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
Basic module providing an helper method to calculate the quantity of product by packaging.
Basic module providing an helper method to calculate the quantity of
product by packaging.
**Table of contents**
@@ -40,40 +41,41 @@ Usage
Imagine you have the following packagings:
* Pallet: 1000 Units
* Big box: 500 Units
* Box: 50 Units
- Pallet: 1000 Units
- Big box: 500 Units
- Box: 50 Units
and you have to pick from your warehouse 2860 Units.
Then you can do:
.. code-block::
::
>>> product.product_qty_by_packaging(2860)
>>> product.product_qty_by_packaging(2860)
[
{"id": 1, "qty": 2, "name": "Pallet"},
{"id": 2, "qty": 1, "name": "Big box"},
{"id": 3, "qty": 7, "name": "Box"},
{"id": 100, "qty": 10, "name": "Units"},
]
[
{"id": 1, "qty": 2, "name": "Pallet"},
{"id": 2, "qty": 1, "name": "Big box"},
{"id": 3, "qty": 7, "name": "Box"},
{"id": 100, "qty": 10, "name": "Units"},
]
With this you can show a proper message to warehouse operators to quickly pick the quantity they need.
With this you can show a proper message to warehouse operators to
quickly pick the quantity they need.
Optionally you can get contained packaging by passing `with_contained` flag:
Optionally you can get contained packaging by passing with_contained
flag:
::
.. code-block::
>>> product.product_qty_by_packaging(2860, with_contained=True)
>>> product.product_qty_by_packaging(2860, with_contained=True)
[
{"id": 1, "qty": 2, "name": "Pallet", "contained": [{"id": 2, "qty": 2, "name": "Big box"}]},
{"id": 2, "qty": 1, "name": "Big box", "contained": [{"id": 3, "qty": 10, "name": "Box"}]},
{"id": 3, "qty": 7, "name": "Box", "contained": [{"id": 100, "qty": 50, "name": "Units"}]},
{"id": 100, "qty": 10, "name": "Units", "contained": []},},
]
[
{"id": 1, "qty": 2, "name": "Pallet", "contained": [{"id": 2, "qty": 2, "name": "Big box"}]},
{"id": 2, "qty": 1, "name": "Big box", "contained": [{"id": 3, "qty": 10, "name": "Box"}]},
{"id": 3, "qty": 7, "name": "Box", "contained": [{"id": 100, "qty": 50, "name": "Units"}]},
{"id": 100, "qty": 10, "name": "Units", "contained": []},},
]
Known issues / Roadmap
======================
@@ -81,7 +83,7 @@ Known issues / Roadmap
TODO
1. Fractional quantities (eg: 0.5 Kg) are lost when counting units
2. Maybe rely on `packaging_uom`
2. Maybe rely on packaging_uom
Bug Tracker
===========
@@ -89,7 +91,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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/stock-logistics-warehouse/issues/new?body=module:%20stock_packaging_calculator%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_packaging_calculator%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.
@@ -97,18 +99,18 @@ Credits
=======
Authors
~~~~~~~
-------
* Camptocamp
Contributors
~~~~~~~~~~~~
------------
* Simone Orsi <simahawk@gmail.com>
* Christopher Ormaza <chris.ormaza@forgeflow.com>
- Simone Orsi <simahawk@gmail.com>
- Christopher Ormaza <chris.ormaza@forgeflow.com>
Maintainers
~~~~~~~~~~~
-----------
This module is maintained by the OCA.
@@ -120,6 +122,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/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_packaging_calculator>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/17.0/stock_packaging_calculator>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@@ -0,0 +1,2 @@
- Simone Orsi \<<simahawk@gmail.com>\>
- Christopher Ormaza \<<chris.ormaza@forgeflow.com>\>

View File

@@ -1,2 +0,0 @@
* Simone Orsi <simahawk@gmail.com>
* Christopher Ormaza <chris.ormaza@forgeflow.com>

View File

@@ -1 +1,2 @@
Basic module providing an helper method to calculate the quantity of product by packaging.
Basic module providing an helper method to calculate the quantity of
product by packaging.

View File

@@ -0,0 +1,4 @@
TODO
1. Fractional quantities (eg: 0.5 Kg) are lost when counting units
2. Maybe rely on packaging_uom

View File

@@ -1,4 +0,0 @@
TODO
1. Fractional quantities (eg: 0.5 Kg) are lost when counting units
2. Maybe rely on `packaging_uom`

View File

@@ -0,0 +1,37 @@
Imagine you have the following packagings:
- Pallet: 1000 Units
- Big box: 500 Units
- Box: 50 Units
and you have to pick from your warehouse 2860 Units.
Then you can do:
> ```
> >>> product.product_qty_by_packaging(2860)
>
> [
> {"id": 1, "qty": 2, "name": "Pallet"},
> {"id": 2, "qty": 1, "name": "Big box"},
> {"id": 3, "qty": 7, "name": "Box"},
> {"id": 100, "qty": 10, "name": "Units"},
> ]
> ```
With this you can show a proper message to warehouse operators to
quickly pick the quantity they need.
Optionally you can get contained packaging by passing with_contained
flag:
> ```
> >>> product.product_qty_by_packaging(2860, with_contained=True)
>
> [
> {"id": 1, "qty": 2, "name": "Pallet", "contained": [{"id": 2, "qty": 2, "name": "Big box"}]},
> {"id": 2, "qty": 1, "name": "Big box", "contained": [{"id": 3, "qty": 10, "name": "Box"}]},
> {"id": 3, "qty": 7, "name": "Box", "contained": [{"id": 100, "qty": 50, "name": "Units"}]},
> {"id": 100, "qty": 10, "name": "Units", "contained": []},},
> ]
> ```

View File

@@ -1,36 +0,0 @@
Imagine you have the following packagings:
* Pallet: 1000 Units
* Big box: 500 Units
* Box: 50 Units
and you have to pick from your warehouse 2860 Units.
Then you can do:
.. code-block::
>>> product.product_qty_by_packaging(2860)
[
{"id": 1, "qty": 2, "name": "Pallet"},
{"id": 2, "qty": 1, "name": "Big box"},
{"id": 3, "qty": 7, "name": "Box"},
{"id": 100, "qty": 10, "name": "Units"},
]
With this you can show a proper message to warehouse operators to quickly pick the quantity they need.
Optionally you can get contained packaging by passing `with_contained` flag:
.. code-block::
>>> product.product_qty_by_packaging(2860, with_contained=True)
[
{"id": 1, "qty": 2, "name": "Pallet", "contained": [{"id": 2, "qty": 2, "name": "Big box"}]},
{"id": 2, "qty": 1, "name": "Big box", "contained": [{"id": 3, "qty": 10, "name": "Box"}]},
{"id": 3, "qty": 7, "name": "Box", "contained": [{"id": 100, "qty": 50, "name": "Units"}]},
{"id": 100, "qty": 10, "name": "Units", "contained": []},},
]

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -369,8 +368,9 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7f199b0f860e5108a32b20d253fdf4e90e51bd2ba3088e0b48c5465c1274b5a8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_packaging_calculator"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_packaging_calculator"><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/stock-logistics-warehouse&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>Basic module providing an helper method to calculate the quantity of product by packaging.</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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/17.0/stock_packaging_calculator"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-17-0/stock-logistics-warehouse-17-0-stock_packaging_calculator"><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/stock-logistics-warehouse&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>Basic module providing an helper method to calculate the quantity of
product by packaging.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -396,7 +396,7 @@ ul.auto-toc {
<p>and you have to pick from your warehouse 2860 Units.</p>
<p>Then you can do:</p>
<blockquote>
<pre class="code literal-block">
<pre class="literal-block">
&gt;&gt;&gt; product.product_qty_by_packaging(2860)
[
@@ -407,10 +407,12 @@ ul.auto-toc {
]
</pre>
</blockquote>
<p>With this you can show a proper message to warehouse operators to quickly pick the quantity they need.</p>
<p>Optionally you can get contained packaging by passing <cite>with_contained</cite> flag:</p>
<p>With this you can show a proper message to warehouse operators to
quickly pick the quantity they need.</p>
<p>Optionally you can get contained packaging by passing with_contained
flag:</p>
<blockquote>
<pre class="code literal-block">
<pre class="literal-block">
&gt;&gt;&gt; product.product_qty_by_packaging(2860, with_contained=True)
[
@@ -427,7 +429,7 @@ ul.auto-toc {
<p>TODO</p>
<ol class="arabic simple">
<li>Fractional quantities (eg: 0.5 Kg) are lost when counting units</li>
<li>Maybe rely on <cite>packaging_uom</cite></li>
<li>Maybe rely on packaging_uom</li>
</ol>
</div>
<div class="section" id="bug-tracker">
@@ -435,7 +437,7 @@ ul.auto-toc {
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/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/stock-logistics-warehouse/issues/new?body=module:%20stock_packaging_calculator%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/stock-logistics-warehouse/issues/new?body=module:%20stock_packaging_calculator%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">
@@ -460,7 +462,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<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/stock-logistics-warehouse/tree/16.0/stock_packaging_calculator">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/17.0/stock_packaging_calculator">OCA/stock-logistics-warehouse</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>

View File

@@ -4,7 +4,6 @@ from odoo.tests import TransactionCase
class TestCommon(TransactionCase):
at_install = False
post_install = True
maxDiff = None