Skip to content

Commit 67543e2

Browse files
committed
Merge PR #1775 into 15.0
Signed-off-by rousseldenis
2 parents 4198798 + 900e724 commit 67543e2

File tree

24 files changed

+3080
-0
lines changed

24 files changed

+3080
-0
lines changed

product_route_profile/README.rst

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
=====================
2+
Product Route Profile
3+
=====================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:5e5c1b0e163469f9f69b63c044b7d995e7c4ac4c0763450fd8075f60d84ecdc5
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/product_route_profile
21+
:alt: OCA/stock-logistics-warehouse
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-product_route_profile
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=14.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
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.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Usage
39+
=====
40+
41+
**Route profile**
42+
In Inventory > Configuration > Settings > Routes Profiles
43+
- Create some Route profile depending on your needs
44+
45+
46+
**On product**
47+
On each template product, in inventory page, we can select:
48+
- **Route Profile**: a default profile, common to all companies
49+
- **Priority Route Profile**: a profile specific to each company and priority if existing.
50+
51+
Known issues / Roadmap
52+
======================
53+
54+
Tests of this module are running separately than the other tests.
55+
56+
Bug Tracker
57+
===========
58+
59+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
60+
In case of trouble, please check there if your issue has already been reported.
61+
If you spotted it first, help us to smash it by providing a detailed and welcomed
62+
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20product_route_profile%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
63+
64+
Do not contact contributors directly about support or help with technical issues.
65+
66+
Credits
67+
=======
68+
69+
Authors
70+
~~~~~~~
71+
72+
* Akretion
73+
74+
Contributors
75+
~~~~~~~~~~~~
76+
77+
* Kévin Roche <kevin.roche@akretion.com>
78+
79+
Maintainers
80+
~~~~~~~~~~~
81+
82+
This module is maintained by the OCA.
83+
84+
.. image:: https://odoo-community.org/logo.png
85+
:alt: Odoo Community Association
86+
:target: https://odoo-community.org
87+
88+
OCA, or the Odoo Community Association, is a nonprofit organization whose
89+
mission is to support the collaborative development of Odoo features and
90+
promote its widespread use.
91+
92+
.. |maintainer-Kev-Roche| image:: https://github.com/Kev-Roche.png?size=40px
93+
:target: https://github.com/Kev-Roche
94+
:alt: Kev-Roche
95+
96+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
97+
98+
|maintainer-Kev-Roche|
99+
100+
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/product_route_profile>`_ project on GitHub.
101+
102+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

product_route_profile/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from .hooks import post_init_hook
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2022 Akretion (https://www.akretion.com).
2+
# @author Kévin Roche <kevin.roche@akretion.com>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "Product Route Profile",
7+
"summary": "Add Route profile concept on product",
8+
"version": "15.0.1.0.0",
9+
"category": "Warehouse",
10+
"website": "https://github.com/OCA/stock-logistics-warehouse",
11+
"author": "Akretion, Odoo Community Association (OCA)",
12+
"maintainers": ["Kev-Roche"],
13+
"license": "AGPL-3",
14+
"application": False,
15+
"installable": True,
16+
"depends": [
17+
"stock",
18+
],
19+
"data": [
20+
"views/route_profile.xml",
21+
"views/product_template.xml",
22+
"security/ir.model.access.csv",
23+
],
24+
"post_init_hook": "post_init_hook",
25+
}

product_route_profile/hooks.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (C) 2022 Akretion (<http://www.akretion.com>).
2+
# @author Kévin Roche <kevin.roche@akretion.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from collections import defaultdict
6+
7+
from odoo import SUPERUSER_ID, api
8+
9+
10+
def post_init_hook(cr, registry):
11+
def get_profile(route_ids):
12+
route_ids = tuple(set(route_ids))
13+
profile = route2profile.get(route_ids)
14+
if not profile:
15+
profile_name = ""
16+
route_names = [
17+
rec.name for rec in env["stock.location.route"].browse(route_ids)
18+
]
19+
profile_name = " / ".join(route_names)
20+
profile = env["route.profile"].create(
21+
{
22+
"name": profile_name,
23+
"route_ids": [(6, 0, route_ids)],
24+
}
25+
)
26+
route2profile[route_ids] = profile
27+
return profile
28+
29+
env = api.Environment(cr, SUPERUSER_ID, {})
30+
query = """
31+
SELECT product_id, array_agg(route_id)
32+
FROM stock_route_product group by product_id;
33+
"""
34+
cr.execute(query)
35+
results = cr.fetchall()
36+
route2profile = {}
37+
profile2product = defaultdict(lambda: env["product.template"])
38+
for row in results:
39+
profile = get_profile(row[1])
40+
profile2product[profile.id] |= env["product.template"].browse(row[0])
41+
42+
for profile in profile2product:
43+
profile2product[profile].write({"route_profile_id": profile})

product_route_profile/i18n/fr.po

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * product_route_profile
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2022-04-27 18:10+0000\n"
10+
"PO-Revision-Date: 2022-04-27 20:13+0200\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"Language: fr\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"Plural-Forms: \n"
18+
"X-Generator: Poedit 3.0.1\n"
19+
20+
#. module: product_route_profile
21+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__company_id
22+
msgid "Company"
23+
msgstr ""
24+
25+
#. module: product_route_profile
26+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__create_uid
27+
msgid "Created by"
28+
msgstr ""
29+
30+
#. module: product_route_profile
31+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__create_date
32+
msgid "Created on"
33+
msgstr ""
34+
35+
#. module: product_route_profile
36+
#: model:ir.model.fields,help:product_route_profile.field_product_product__route_ids
37+
#: model:ir.model.fields,help:product_route_profile.field_product_template__route_ids
38+
msgid ""
39+
"Depending on the modules installed, this will allow you to define the route "
40+
"of the product: whether it will be bought, manufactured, replenished on "
41+
"order, etc."
42+
msgstr ""
43+
"En fonction des modules installés, cela va vous permettre de définir les "
44+
"routes sur l'article: acheter, fabriquer, réapprovisionner sur commande, etc."
45+
46+
#. module: product_route_profile
47+
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__display_name
48+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__display_name
49+
msgid "Display Name"
50+
msgstr "Nom"
51+
52+
#. module: product_route_profile
53+
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__id
54+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__id
55+
msgid "ID"
56+
msgstr ""
57+
58+
#. module: product_route_profile
59+
#: model:ir.model.fields,help:product_route_profile.field_product_product__force_route_profile_id
60+
#: model:ir.model.fields,help:product_route_profile.field_product_template__force_route_profile_id
61+
msgid ""
62+
"If defined, the priority route profile will be used and will replace the "
63+
"route profile, only for this company."
64+
msgstr ""
65+
66+
#. module: product_route_profile
67+
#: model:ir.model.fields,field_description:product_route_profile.field_product_template____last_update
68+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile____last_update
69+
msgid "Last Modified on"
70+
msgstr "Dernière modification le"
71+
72+
#. module: product_route_profile
73+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__write_uid
74+
msgid "Last Updated by"
75+
msgstr ""
76+
77+
#. module: product_route_profile
78+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__write_date
79+
msgid "Last Updated on"
80+
msgstr ""
81+
82+
#. module: product_route_profile
83+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__name
84+
msgid "Name"
85+
msgstr ""
86+
87+
#. module: product_route_profile
88+
#: model:ir.model.fields,field_description:product_route_profile.field_product_product__force_route_profile_id
89+
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__force_route_profile_id
90+
msgid "Priority Route Profile"
91+
msgstr "Profil de Routes Prioritaires"
92+
93+
#. module: product_route_profile
94+
#: model:ir.model,name:product_route_profile.model_product_template
95+
msgid "Product Template"
96+
msgstr "Modèle de produit"
97+
98+
#. module: product_route_profile
99+
#: model:ir.model,name:product_route_profile.model_route_profile
100+
#: model:ir.model.fields,field_description:product_route_profile.field_product_product__route_profile_id
101+
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__route_profile_id
102+
msgid "Route Profile"
103+
msgstr "Profil de routes"
104+
105+
#. module: product_route_profile
106+
#: model:ir.model.fields,field_description:product_route_profile.field_product_product__route_ids
107+
#: model:ir.model.fields,field_description:product_route_profile.field_product_template__route_ids
108+
#: model:ir.model.fields,field_description:product_route_profile.field_route_profile__route_ids
109+
msgid "Routes"
110+
msgstr "Routes"
111+
112+
#. module: product_route_profile
113+
#: model:ir.actions.act_window,name:product_route_profile.action_route_profile_form
114+
#: model:ir.ui.menu,name:product_route_profile.menu_route_profile_config
115+
#: model_terms:ir.ui.view,arch_db:product_route_profile.route_profile_form
116+
msgid "Routes Profiles"
117+
msgstr "Profils de Routes"
118+
119+
#. module: product_route_profile
120+
#: model_terms:ir.actions.act_window,help:product_route_profile.action_route_profile_form
121+
msgid ""
122+
"You can define here the routes profiles that run through\n"
123+
" your warehouses and that define the flows of your products.\n"
124+
" A route profile can be set on each product as \"Route Profile"
125+
"\" or \"Priority Route Profile\" (company dependent)."
126+
msgstr ""
127+
"Vous pouvez définir ici les routes qui régissent les mouvements de vos "
128+
"produits dans vos entrepôts. \n"
129+
"Un profil de route peut être défini pour chaque produit en tant que \"Profil "
130+
"de Routes\" ou \"Profil de Routes Prioritaires\" (société dépendant)."

0 commit comments

Comments
 (0)