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

[17.0][MIG] product route profile: Migration to 17.0 #2097

Merged
merged 19 commits into from
Oct 8, 2024
Merged
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
102 changes: 102 additions & 0 deletions product_route_profile/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
=====================
Product Route Profile
=====================

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

.. |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--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/17.0/product_route_profile
: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-17-0/stock-logistics-warehouse-17-0-product_route_profile
: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=17.0
:alt: Try me on Runboat

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

This module replaces the initial concept of route_ids with a new concept
of "route profile", coming with a company-specific and priority route
profile.

**Table of contents**

.. contents::
:local:

Usage
=====

**Route profile** In Inventory > Configuration > Settings > Routes
Profiles - Create some Route profile depending on your needs

**On product** On each template product, in inventory page, we can
select: - **Route Profile**: a default profile, common to all companies
- **Priority Route Profile**: a profile specific to each company and
priority if existing.

Known issues / Roadmap
======================

Tests of this module are running separately than the other tests.

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:%20product_route_profile%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.

Credits
=======

Authors
-------

* Akretion

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

- Kévin Roche <[email protected]>

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-Kev-Roche| image:: https://github.com/Kev-Roche.png?size=40px
:target: https://github.com/Kev-Roche
:alt: Kev-Roche

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

|maintainer-Kev-Roche|

This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/17.0/product_route_profile>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions product_route_profile/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook
25 changes: 25 additions & 0 deletions product_route_profile/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2022 Akretion (https://www.akretion.com).
# @author Kévin Roche <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Product Route Profile",
"summary": "Add Route profile concept on product",
"version": "17.0.1.0.0",
"category": "Warehouse",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Akretion, Odoo Community Association (OCA)",
"maintainers": ["Kev-Roche"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"stock",
],
"data": [
"views/route_profile.xml",
"views/product_template.xml",
"security/ir.model.access.csv",
],
"post_init_hook": "post_init_hook",
}
38 changes: 38 additions & 0 deletions product_route_profile/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (C) 2022 Akretion (<http://www.akretion.com>).
# @author Kévin Roche <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from collections import defaultdict


def post_init_hook(env):
def get_profile(route_ids):
route_ids = tuple(set(route_ids))
profile = route2profile.get(route_ids)

Check warning on line 11 in product_route_profile/hooks.py

View check run for this annotation

Codecov / codecov/patch

product_route_profile/hooks.py#L10-L11

Added lines #L10 - L11 were not covered by tests
if not profile:
profile_name = ""

Check warning on line 13 in product_route_profile/hooks.py

View check run for this annotation

Codecov / codecov/patch

product_route_profile/hooks.py#L13

Added line #L13 was not covered by tests
route_names = [rec.name for rec in env["stock.route"].browse(route_ids)]
profile_name = " / ".join(route_names)
profile = env["route.profile"].create(

Check warning on line 16 in product_route_profile/hooks.py

View check run for this annotation

Codecov / codecov/patch

product_route_profile/hooks.py#L15-L16

Added lines #L15 - L16 were not covered by tests
{
"name": profile_name,
"route_ids": [(6, 0, route_ids)],
}
)
route2profile[route_ids] = profile
return profile

Check warning on line 23 in product_route_profile/hooks.py

View check run for this annotation

Codecov / codecov/patch

product_route_profile/hooks.py#L22-L23

Added lines #L22 - L23 were not covered by tests

query = """
SELECT product_id, array_agg(route_id)
FROM stock_route_product group by product_id;
"""
env.cr.execute(query)
results = env.cr.fetchall()
route2profile = {}
profile2product = defaultdict(lambda: env["product.template"])
for row in results:
profile = get_profile(row[1])
profile2product[profile.id] |= env["product.template"].browse(row[0])

Check warning on line 35 in product_route_profile/hooks.py

View check run for this annotation

Codecov / codecov/patch

product_route_profile/hooks.py#L34-L35

Added lines #L34 - L35 were not covered by tests

for profile in profile2product:
profile2product[profile].write({"route_profile_id": profile})

Check warning on line 38 in product_route_profile/hooks.py

View check run for this annotation

Codecov / codecov/patch

product_route_profile/hooks.py#L38

Added line #L38 was not covered by tests
130 changes: 130 additions & 0 deletions product_route_profile/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_route_profile
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-04-27 18:10+0000\n"
"PO-Revision-Date: 2022-04-27 20:13+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.0.1\n"

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__company_id
msgid "Company"
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__create_uid
msgid "Created by"
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__create_date
msgid "Created on"
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,help:product_route_profile.field_product_product__route_ids
#: model:ir.model.fields,help:product_route_profile.field_product_template__route_ids
msgid ""
"Depending on the modules installed, this will allow you to define the route "
"of the product: whether it will be bought, manufactured, replenished on "
"order, etc."
msgstr ""
"En fonction des modules installés, cela va vous permettre de définir les "
"routes sur l'article: acheter, fabriquer, réapprovisionner sur commande, etc."

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__display_name
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__display_name
msgid "Display Name"
msgstr "Nom"

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__id
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__id
msgid "ID"
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,help:product_route_profile.field_product_product__force_route_profile_id
#: model:ir.model.fields,help:product_route_profile.field_product_template__force_route_profile_id
msgid ""
"If defined, the priority route profile will be used and will replace the "
"route profile, only for this company."
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_product_template____last_update
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__write_uid
msgid "Last Updated by"
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__write_date
msgid "Last Updated on"
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__name
msgid "Name"
msgstr ""

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_product_product__force_route_profile_id
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__force_route_profile_id
msgid "Priority Route Profile"
msgstr "Profil de Routes Prioritaires"

#. module: product_route_profile
#: model:ir.model,name:product_route_profile.model_product_template
msgid "Product Template"
msgstr "Modèle de produit"

#. module: product_route_profile
#: model:ir.model,name:product_route_profile.model_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_product_product__route_profile_id
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__route_profile_id
msgid "Route Profile"
msgstr "Profil de routes"

#. module: product_route_profile
#: model:ir.model.fields,field_description:product_route_profile.field_product_product__route_ids
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__route_ids
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__route_ids
msgid "Routes"
msgstr "Routes"

#. module: product_route_profile
#: model:ir.actions.act_window,name:product_route_profile.action_route_profile_form
#: model:ir.ui.menu,name:product_route_profile.menu_route_profile_config
#: model_terms:ir.ui.view,arch_db:product_route_profile.route_profile_form
msgid "Routes Profiles"
msgstr "Profils de Routes"

#. module: product_route_profile
#: model_terms:ir.actions.act_window,help:product_route_profile.action_route_profile_form
msgid ""
"You can define here the routes profiles that run through\n"
" your warehouses and that define the flows of your products.\n"
" A route profile can be set on each product as \"Route Profile"
"\" or \"Priority Route Profile\" (company dependent)."
msgstr ""
"Vous pouvez définir ici les routes qui régissent les mouvements de vos "
"produits dans vos entrepôts. \n"
"Un profil de route peut être défini pour chaque produit en tant que \"Profil "
"de Routes\" ou \"Profil de Routes Prioritaires\" (société dépendant)."
Loading
Loading