Skip to content

Commit

Permalink
[MIG] stock_packaging_calculator_packaging_level: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimkhoi3010 committed Jan 14, 2025
1 parent e45f15f commit 1b06d8f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
7 changes: 5 additions & 2 deletions stock_packaging_calculator_packaging_level/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ Contributors
- `Trobz <https://trobz.com>`__:

- Nguyen Hoang Hiep <[email protected]>
- Khoi (Kien Kim) <[email protected]>

Other credits
-------------

The migration of this module from 13.0 to 14.0 was financially supported
by Camptocamp
The migration of this module from 13.0 to 14.0 and then from 16.0 to
18.0 was financially supported by:

- Camptocamp

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion stock_packaging_calculator_packaging_level/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Stock packaging calculator packaging level",
"summary": "Glue module for packaging level",
"version": "16.0.1.0.0",
"version": "18.0.1.0.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-warehouse",
Expand Down
11 changes: 5 additions & 6 deletions stock_packaging_calculator_packaging_level/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ def _packaging_name_getter(self, packaging):

def _qty_by_packaging_as_str(self, packaging, qty):
# By default use packaging type code
qty_by_packaging_type_fname = self.env.context.get(
"qty_by_packaging_type_fname", "code"
qty_by_packaging_level_fname = self.env.context.get(
"qty_by_packaging_level_fname", "code"
)
compact_mode = self.env.context.get("qty_by_packaging_type_compact", True)
compact_mode = self.env.context.get("qty_by_packaging_level_compact", True)
sep = "" if compact_mode else " "
# Override to use packaging level code
if packaging and packaging.packaging_level_id:
name = packaging.packaging_level_id[qty_by_packaging_type_fname]
name = packaging.packaging_level_id[qty_by_packaging_level_fname]
return f"{qty}{sep}{name}"
else:
return super()._qty_by_packaging_as_str(packaging, qty)
return super()._qty_by_packaging_as_str(packaging, qty)

Check warning on line 24 in stock_packaging_calculator_packaging_level/models/product.py

View check run for this annotation

Codecov / codecov/patch

stock_packaging_calculator_packaging_level/models/product.py#L24

Added line #L24 was not covered by tests
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class ProductQtyByPackagingMixin(models.AbstractModel):
@api.depends_context(
"lang",
"qty_by_pkg_total_units",
"qty_by_packaging_type_fname",
"qty_by_packaging_type_compact",
"qty_by_packaging_level_fname",
"qty_by_packaging_level_compact",
)
def _compute_product_qty_by_packaging_display(self):
return super()._compute_product_qty_by_packaging_display()

Check warning on line 22 in stock_packaging_calculator_packaging_level/models/product_qty_by_packaging_mixin.py

View check run for this annotation

Codecov / codecov/patch

stock_packaging_calculator_packaging_level/models/product_qty_by_packaging_mixin.py#L22

Added line #L22 was not covered by tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- Simone Orsi \<<[email protected]>\>

- [Trobz](https://trobz.com):
- [Trobz](https://trobz.com):
- Nguyen Hoang Hiep \<<[email protected]>\>
- Khoi (Kien Kim) \<<[email protected]>\>
5 changes: 3 additions & 2 deletions stock_packaging_calculator_packaging_level/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
The migration of this module from 13.0 to 14.0 was financially supported
by Camptocamp
The migration of this module from 13.0 to 14.0 and then from 16.0 to 18.0 was financially supported by:

- Camptocamp
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,18 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>Simone Orsi &lt;<a class="reference external" href="mailto:simone.orsi&#64;camptocamp.com">simone.orsi&#64;camptocamp.com</a>&gt;</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
<li>Nguyen Hoang Hiep &lt;<a class="reference external" href="mailto:hiepnh&#64;trobz.com">hiepnh&#64;trobz.com</a>&gt;</li>
<li>Khoi (Kien Kim) &lt;<a class="reference external" href="mailto:khoikk&#64;trobz.com">khoikk&#64;trobz.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
<p>The migration of this module from 13.0 to 14.0 was financially supported
by Camptocamp</p>
<p>The migration of this module from 13.0 to 14.0 and then from 16.0 to
18.0 was financially supported by:</p>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def test_as_str(self):
)
self.assertEqual(
self.product_a.with_context(
qty_by_packaging_type_fname="name",
qty_by_packaging_type_compact=False,
qty_by_packaging_level_fname="name",
qty_by_packaging_level_compact=False,
).product_qty_by_packaging_as_str(250),
"1 Transport Box,\xa01 Retail Box",
)

0 comments on commit 1b06d8f

Please sign in to comment.