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_dangerous_goods: Migration to 18.0 #1786

Open
wants to merge 7 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
92 changes: 92 additions & 0 deletions stock_dangerous_goods/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
=====================
Stock Dangerous Goods
=====================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_dangerous_goods
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_dangerous_goods
: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-workflow&target_branch=18.0
:alt: Try me on Runboat

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

This is a glue module between stock and l10n_eu_product_adr. This
modules adds a few utility fields about dangerous products.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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-workflow/issues/new?body=module:%20stock_dangerous_goods%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 SA

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

- Matthieu Méquignon <matthieu.mequignon@camptocamp.com>
- Do Anh Duy <duyda@trobz.com>

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

The migration of this module from 14.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.

.. |maintainer-mmequignon| image:: https://github.com/mmequignon.png?size=40px
:target: https://github.com/mmequignon
:alt: mmequignon

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-mmequignon|

This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_dangerous_goods>`_ 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_dangerous_goods/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions stock_dangerous_goods/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Stock Dangerous Goods",
"summary": "Adds utility fields to manage dangerous goods",
"version": "18.0.1.0.0",
"category": "Inventory",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Camptocamp SA, Odoo Community Association (OCA)",
"maintainers": ["mmequignon"],
"license": "AGPL-3",
"installable": True,
"depends": [
"stock",
# OCA/community-data-files
"l10n_eu_product_adr_dangerous_goods",
],
}
68 changes: 68 additions & 0 deletions stock_dangerous_goods/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_dangerous_goods
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\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"

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product__display_name
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line__display_name
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package__display_name
msgid "Display Name"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package__has_lq_products
msgid "Has Lq Products"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product__id
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line__id
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package__id
msgid "ID"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product__is_lq_product
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line__has_lq_products
msgid "Is Lq Product"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product____last_update
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line____last_update
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model,name:stock_dangerous_goods.model_stock_quant_package
msgid "Packages"
msgstr ""

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

#. module: stock_dangerous_goods
#: model:ir.model,name:stock_dangerous_goods.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,help:stock_dangerous_goods.field_product_product__is_lq_product
#: model:ir.model.fields,help:stock_dangerous_goods.field_stock_move_line__has_lq_products
msgid "Whether this product is a Limited Quantity product or not"
msgstr ""
67 changes: 67 additions & 0 deletions stock_dangerous_goods/i18n/stock_dangerous_goods.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_dangerous_goods
#
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_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product__display_name
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line__display_name
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package__display_name
msgid "Display Name"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package__has_lq_products
msgid "Has Lq Products"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product__id
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line__id
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package__id
msgid "ID"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product__is_lq_product
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line__has_lq_products
msgid "Is Lq Product"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_product_product____last_update
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_move_line____last_update
#: model:ir.model.fields,field_description:stock_dangerous_goods.field_stock_quant_package____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model,name:stock_dangerous_goods.model_stock_quant_package
msgid "Packages"
msgstr ""

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

#. module: stock_dangerous_goods
#: model:ir.model,name:stock_dangerous_goods.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: stock_dangerous_goods
#: model:ir.model.fields,help:stock_dangerous_goods.field_product_product__is_lq_product
#: model:ir.model.fields,help:stock_dangerous_goods.field_stock_move_line__has_lq_products
msgid "Whether this product is a Limited Quantity product or not"
msgstr ""
3 changes: 3 additions & 0 deletions stock_dangerous_goods/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import stock_move_line
from . import stock_quant_package
from . import product_product
23 changes: 23 additions & 0 deletions stock_dangerous_goods/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import api, fields, models


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

is_lq_product = fields.Boolean(
compute="_compute_is_lq_product",
help="Whether this product is a Limited Quantity product or not",
)

@api.depends("limited_amount_id", "is_dangerous")
def _compute_is_lq_product(self):
limited_amount_lq = self.env.ref(

Check warning on line 17 in stock_dangerous_goods/models/product_product.py

View check run for this annotation

Codecov / codecov/patch

stock_dangerous_goods/models/product_product.py#L17

Added line #L17 was not covered by tests
"l10n_eu_product_adr_dangerous_goods.limited_amount_1"
)
for record in self:
record.is_lq_product = (

Check warning on line 21 in stock_dangerous_goods/models/product_product.py

View check run for this annotation

Codecov / codecov/patch

stock_dangerous_goods/models/product_product.py#L21

Added line #L21 was not covered by tests
record.is_dangerous and record.limited_amount_id == limited_amount_lq
)
10 changes: 10 additions & 0 deletions stock_dangerous_goods/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import fields, models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

has_lq_products = fields.Boolean(related="product_id.is_lq_product")
22 changes: 22 additions & 0 deletions stock_dangerous_goods/models/stock_quant_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import api, fields, models


class StockQuantPackage(models.Model):
_inherit = "stock.quant.package"

has_lq_products = fields.Boolean(compute="_compute_has_lq_products")

@api.depends("quant_ids.product_id.is_lq_product")
def _compute_has_lq_products(self):
for record in self:
record.has_lq_products = record._has_lq_products()

Check warning on line 15 in stock_dangerous_goods/models/stock_quant_package.py

View check run for this annotation

Codecov / codecov/patch

stock_dangerous_goods/models/stock_quant_package.py#L15

Added line #L15 was not covered by tests

def _has_lq_products(self):
self.ensure_one()

Check warning on line 18 in stock_dangerous_goods/models/stock_quant_package.py

View check run for this annotation

Codecov / codecov/patch

stock_dangerous_goods/models/stock_quant_package.py#L18

Added line #L18 was not covered by tests
for quant in self.quant_ids:
if quant.product_id.is_lq_product:
return True
return False

Check warning on line 22 in stock_dangerous_goods/models/stock_quant_package.py

View check run for this annotation

Codecov / codecov/patch

stock_dangerous_goods/models/stock_quant_package.py#L21-L22

Added lines #L21 - L22 were not covered by tests
3 changes: 3 additions & 0 deletions stock_dangerous_goods/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions stock_dangerous_goods/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Matthieu Méquignon \<<matthieu.mequignon@camptocamp.com>\>
- Do Anh Duy \<<duyda@trobz.com>\>
1 change: 1 addition & 0 deletions stock_dangerous_goods/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 14.0 to 18.0 was financially supported by Camptocamp.
2 changes: 2 additions & 0 deletions stock_dangerous_goods/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is a glue module between stock and l10n_eu_product_adr. This
modules adds a few utility fields about dangerous products.
Binary file added stock_dangerous_goods/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading