Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] stock_packaging_calculator_packaging_level: Migration to 18.0 #2234

Open
wants to merge 8 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions stock_packaging_calculator_packaging_level/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
==========================================
Stock packaging calculator packaging level
==========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6d395920ee87d2b9292b23a536119ee0d9bf4d3722e368ec22b568797137afdb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
: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/18.0/stock_packaging_calculator_packaging_level
: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-18-0/stock-logistics-warehouse-18-0-stock_packaging_calculator_packaging_level
: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=18.0
:alt: Try me on Runboat

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

Glue module for stock_packaging_calculator and product_packaging_type.

Mainly to use packaging type's code instead of packaging's name.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

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_packaging_level%0Aversion:%2018.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
-------

* Camptocamp

Contributors
------------

- Simone Orsi <[email protected]>

- `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 and then from 16.0 to
18.0 was financially supported by:

- Camptocamp

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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/18.0/stock_packaging_calculator_packaging_level>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_packaging_calculator_packaging_level/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions stock_packaging_calculator_packaging_level/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2021 Camptocamp SA
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl)
{
"name": "Stock packaging calculator packaging level",
"summary": "Glue module for packaging level",
"version": "18.0.1.0.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": ["stock_packaging_calculator", "product_packaging_level"],
}
27 changes: 27 additions & 0 deletions stock_packaging_calculator_packaging_level/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_packaging_calculator_packaging_level
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-04-19 07:37+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: stock_packaging_calculator_packaging_level
#: model:ir.model,name:stock_packaging_calculator_packaging_level.model_product_qty_by_packaging_mixin
msgid "Product Qty By Packaging (Mixin)"
msgstr "Q.tà prodotto per confezione (mixin)"

#. module: stock_packaging_calculator_packaging_level
#: model:ir.model,name:stock_packaging_calculator_packaging_level.model_product_product
msgid "Product Variant"
msgstr "Variante prodotto"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_packaging_calculator_packaging_level
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_packaging_calculator_packaging_level
#: model:ir.model,name:stock_packaging_calculator_packaging_level.model_product_qty_by_packaging_mixin
msgid "Product Qty By Packaging (Mixin)"
msgstr ""

#. module: stock_packaging_calculator_packaging_level
#: model:ir.model,name:stock_packaging_calculator_packaging_level.model_product_product
msgid "Product Variant"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_packaging_calculator_packaging_type
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_packaging_calculator_packaging_type
#: model:ir.model.fields,field_description:stock_packaging_calculator_packaging_type.field_product_product__display_name
#: model:ir.model.fields,field_description:stock_packaging_calculator_packaging_type.field_product_qty_by_packaging_mixin__display_name
msgid "Display Name"
msgstr ""

#. module: stock_packaging_calculator_packaging_type
#: model:ir.model.fields,field_description:stock_packaging_calculator_packaging_type.field_product_product__id
#: model:ir.model.fields,field_description:stock_packaging_calculator_packaging_type.field_product_qty_by_packaging_mixin__id
msgid "ID"
msgstr ""

#. module: stock_packaging_calculator_packaging_type
#: model:ir.model.fields,field_description:stock_packaging_calculator_packaging_type.field_product_product____last_update
#: model:ir.model.fields,field_description:stock_packaging_calculator_packaging_type.field_product_qty_by_packaging_mixin____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_packaging_calculator_packaging_type
#: model:ir.model,name:stock_packaging_calculator_packaging_type.model_product_product
msgid "Product"
msgstr ""

#. module: stock_packaging_calculator_packaging_type
#: model:ir.model,name:stock_packaging_calculator_packaging_type.model_product_qty_by_packaging_mixin
msgid "Product Qty By Packaging (Mixin)"
msgstr ""
2 changes: 2 additions & 0 deletions stock_packaging_calculator_packaging_level/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product
from . import product_qty_by_packaging_mixin
24 changes: 24 additions & 0 deletions stock_packaging_calculator_packaging_level/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2021 Camptocamp SA
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl)

from odoo import models


class Product(models.Model):
_inherit = "product.product"

def _packaging_name_getter(self, packaging):
return packaging.packaging_level_id.name

def _qty_by_packaging_as_str(self, packaging, qty):
# By default use packaging type 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_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_level_fname]
return f"{qty}{sep}{name}"
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
@@ -0,0 +1,22 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <[email protected]>
# @author: Sébastien Alix <[email protected]>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl)
from odoo import api, models


class ProductQtyByPackagingMixin(models.AbstractModel):
"""Allow displaying product qty by packaging."""

_inherit = "product.qty_by_packaging.mixin"

# Amazing.. unlike `api.depends`, `depends_context` cannot use a lambda
# to delegate lookup. Hence we are forced to override and call super.
@api.depends_context(
"lang",
"qty_by_pkg_total_units",
"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
3 changes: 3 additions & 0 deletions stock_packaging_calculator_packaging_level/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Simone Orsi \<<[email protected]>\>

- [Trobz](https://trobz.com):
- Nguyen Hoang Hiep \<<[email protected]>\>
- Khoi (Kien Kim) \<<[email protected]>\>
3 changes: 3 additions & 0 deletions stock_packaging_calculator_packaging_level/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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
@@ -0,0 +1,3 @@
Glue module for stock_packaging_calculator and product_packaging_type.

Mainly to use packaging type's code instead of packaging's name.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading