forked from OCA/stock-logistics-warehouse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1640 from OCA/17.0
Syncing from upstream OCA/stock-logistics-warehouse (17.0)
- Loading branch information
Showing
21 changed files
with
942 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
====================================== | ||
Product template in putaway strategies | ||
====================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:9afc0956ce502c979e7e1b0a60c4f76c6e88927adc56970311ddcda0ef1aae05 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/stock_putaway_product_template | ||
: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-stock_putaway_product_template | ||
: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 add product template in putaway strategies from the product | ||
view to not need defined putaway strategies for all variants. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
- In Inventory Settings, set "Storage Locations" to True | ||
- User should be in "Manage push and pull inventory flows" | ||
- Inside a product go to "Putaway rules" | ||
- It's possible to define record to template | ||
|
||
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_putaway_product_template%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 | ||
------------ | ||
|
||
- `Akretion <https://www.akretion.com>`__: | ||
|
||
- Kevin Khao <[email protected]> | ||
|
||
- `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
- Sergio Teruel | ||
- Víctor Martínez | ||
- César A. Sánchez | ||
- Carolina Fernandez | ||
|
||
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-kevinkhao| image:: https://github.com/kevinkhao.png?size=40px | ||
:target: https://github.com/kevinkhao | ||
:alt: kevinkhao | ||
.. |maintainer-sebastienbeau| image:: https://github.com/sebastienbeau.png?size=40px | ||
:target: https://github.com/sebastienbeau | ||
:alt: sebastienbeau | ||
|
||
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-kevinkhao| |maintainer-sebastienbeau| | ||
|
||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/17.0/stock_putaway_product_template>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2023 Tecnativa - Carolina Fernandez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Product template in putaway strategies", | ||
"summary": "Add product template in putaway strategies from the product view", | ||
"version": "17.0.1.0.0", | ||
"category": "Inventory", | ||
"website": "https://github.com/OCA/stock-logistics-warehouse", | ||
"author": "Akretion, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": ["stock"], | ||
"data": ["views/stock_putaway_rule_views.xml"], | ||
"maintainers": ["kevinkhao", "sebastienbeau"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_putaway_product_template | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2021-11-11 09:02+0000\n" | ||
"PO-Revision-Date: 2023-10-09 08:09+0000\n" | ||
"Last-Translator: Ivorra78 <[email protected]>\n" | ||
"Language-Team: \n" | ||
"Language: es\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_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_stock_location | ||
msgid "Inventory Locations" | ||
msgstr "Ubicaciones de inventario" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_product_template | ||
msgid "Product" | ||
msgstr "Producto" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__product_tmpl_id | ||
msgid "Product Tmpl" | ||
msgstr "Plantilla de producto" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_stock_putaway_rule | ||
msgid "Putaway Rule" | ||
msgstr "Regla de Estrategia de Traslado" | ||
|
||
#~ msgid "Display Name" | ||
#~ msgstr "Nombre mostrado" | ||
|
||
#~ msgid "ID" | ||
#~ msgstr "ID (identificación)" | ||
|
||
#~ msgid "Last Modified on" | ||
#~ msgstr "Última modificación el" | ||
|
||
#~ msgid "Product Template" | ||
#~ msgstr "Plantilla de producto" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_putaway_product_template | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-11-21 13:33+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_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_stock_location | ||
msgid "Inventory Locations" | ||
msgstr "Ubicazioni di inventario" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_product_template | ||
msgid "Product" | ||
msgstr "Prodotto" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__product_tmpl_id | ||
msgid "Product Tmpl" | ||
msgstr "Modello prodotto" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_stock_putaway_rule | ||
msgid "Putaway Rule" | ||
msgstr "Regola stoccaggio" |
34 changes: 34 additions & 0 deletions
34
stock_putaway_product_template/i18n/stock_putaway_product_template.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_putaway_product_template | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 17.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_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_stock_location | ||
msgid "Inventory Locations" | ||
msgstr "" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_product_template | ||
msgid "Product" | ||
msgstr "" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__product_tmpl_id | ||
msgid "Product Tmpl" | ||
msgstr "" | ||
|
||
#. module: stock_putaway_product_template | ||
#: model:ir.model,name:stock_putaway_product_template.model_stock_putaway_rule | ||
msgid "Putaway Rule" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import product | ||
from . import stock_location | ||
from . import stock_putaway_rule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
# Copyright 2021 Tecnativa - Víctor Martínez | ||
|
||
from odoo import models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
def action_view_related_putaway_rules(self): | ||
self.ensure_one() | ||
domain = [ | ||
"|", | ||
"|", | ||
("product_tmpl_id", "=", self.id), | ||
("category_id", "=", self.categ_id.id), | ||
("product_id.product_tmpl_id", "=", self.id), | ||
] | ||
return self._get_action_view_related_putaway_rules(domain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
# Copyright 2020 Tecnativa - Sergio Teruel | ||
|
||
from odoo import models | ||
|
||
|
||
class StockLocation(models.Model): | ||
_inherit = "stock.location" | ||
|
||
def _get_putaway_strategy( | ||
self, product, quantity=0, package=None, packaging=None, additional_qty=None | ||
): | ||
return super( | ||
StockLocation, self.with_context(filter_putaway_rule=True) | ||
)._get_putaway_strategy( | ||
product, | ||
quantity=quantity, | ||
package=package, | ||
packaging=packaging, | ||
additional_qty=additional_qty, | ||
) |
53 changes: 53 additions & 0 deletions
53
stock_putaway_product_template/models/stock_putaway_rule.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
# Copyright 2020 Sergio Teruel - Tecnativa | ||
# Copyright 2020 Víctor Martínez - Tecnativa | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class StockPutawayRule(models.Model): | ||
_inherit = "stock.putaway.rule" | ||
|
||
product_tmpl_id = fields.Many2one( | ||
comodel_name="product.template", | ||
compute="_compute_product_tmpl_id", | ||
domain="[('id', '=', context.get('active_id', False))] " | ||
"if context.get('active_model') == 'product.template' " | ||
"else [('type', '!=', 'service')]", | ||
store=True, | ||
readonly=False, | ||
ondelete="cascade", | ||
) | ||
|
||
@api.depends("product_id") | ||
def _compute_product_tmpl_id(self): | ||
for rec in self: | ||
if rec.product_id: | ||
rec.product_tmpl_id = rec.product_id.product_tmpl_id | ||
else: | ||
params = self.env.context.get("params", {}) | ||
if params.get("model", "") == "product.template" and params.get("id"): | ||
rec.product_tmpl_id = params.get("id") | ||
|
||
def filtered(self, func): | ||
res = super().filtered(func) | ||
if res or not self.env.context.get("filter_putaway_rule"): | ||
return res | ||
if isinstance(func, str): | ||
name = func | ||
|
||
def func(rec): | ||
any(rec.mapped(name)) | ||
|
||
# populate cache | ||
self.mapped(name) | ||
product = func.__closure__[0].cell_contents | ||
if isinstance(product, str): | ||
return res | ||
if product._name != "product.product": | ||
return res | ||
return self.with_context(filter_putaway_rule=False).filtered( | ||
lambda x: ( | ||
x.product_tmpl_id == product.product_tmpl_id and not x.product_id | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
- [Akretion](https://www.akretion.com): | ||
- Kevin Khao \<<[email protected]>\> | ||
- [Tecnativa](https://www.tecnativa.com): | ||
- Sergio Teruel | ||
- Víctor Martínez | ||
- César A. Sánchez | ||
- Carolina Fernandez |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This module add product template in putaway strategies from the product | ||
view to not need defined putaway strategies for all variants. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- In Inventory Settings, set "Storage Locations" to True | ||
- User should be in "Manage push and pull inventory flows" | ||
- Inside a product go to "Putaway rules" | ||
- It's possible to define record to template |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.