From 760fd23e88a4bd937be2f9076d13905cc1956eec Mon Sep 17 00:00:00 2001 From: sergio-teruel Date: Wed, 26 Oct 2022 16:11:32 +0200 Subject: [PATCH] [MIG] stock_putaway_product_template: Migration to v15.0 [UPD] Update stock_putaway_product_template.pot --- stock_putaway_product_template/README.rst | 11 ++-- .../__manifest__.py | 2 +- stock_putaway_product_template/i18n/es.po | 57 +++++++++++++++++++ .../i18n/stock_putaway_product_template.pot | 2 +- .../models/stock_location.py | 12 +++- .../models/stock_putaway_rule.py | 17 ++++-- .../readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 7 ++- 8 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 stock_putaway_product_template/i18n/es.po diff --git a/stock_putaway_product_template/README.rst b/stock_putaway_product_template/README.rst index 5cccb42c0..819fb9384 100644 --- a/stock_putaway_product_template/README.rst +++ b/stock_putaway_product_template/README.rst @@ -14,13 +14,13 @@ Product template in putaway strategies :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/13.0/stock_putaway_product_template + :target: https://github.com/OCA/stock-logistics-warehouse/tree/15.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-13-0/stock-logistics-warehouse-13-0-stock_putaway_product_template + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_putaway_product_template :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/153/13.0 + :target: https://runbot.odoo-community.org/runbot/153/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -46,7 +46,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -69,6 +69,7 @@ Contributors * Sergio Teruel * Víctor Martínez + * César A. Sánchez Maintainers ~~~~~~~~~~~ @@ -94,6 +95,6 @@ Current `maintainers `__: |maintainer-kevinkhao| |maintainer-sebastienbeau| -This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_putaway_product_template/__manifest__.py b/stock_putaway_product_template/__manifest__.py index aad331fcc..93bf6c0f8 100644 --- a/stock_putaway_product_template/__manifest__.py +++ b/stock_putaway_product_template/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Product template in putaway strategies", "summary": "Add product template in putaway strategies from the product view", - "version": "13.0.1.1.0", + "version": "15.0.1.0.0", "category": "Inventory", "website": "https://github.com/OCA/stock-logistics-warehouse", "author": "Akretion, Odoo Community Association (OCA)", diff --git a/stock_putaway_product_template/i18n/es.po b/stock_putaway_product_template/i18n/es.po new file mode 100644 index 000000000..0ecc07298 --- /dev/null +++ b/stock_putaway_product_template/i18n/es.po @@ -0,0 +1,57 @@ +# 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: 2021-11-11 09:02+0000\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.fields,field_description:stock_putaway_product_template.field_product_template__display_name +#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_location__display_name +#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: stock_putaway_product_template +#: model:ir.model.fields,field_description:stock_putaway_product_template.field_product_template__id +#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_location__id +#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__id +msgid "ID" +msgstr "" + +#. 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.fields,field_description:stock_putaway_product_template.field_product_template____last_update +#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_location____last_update +#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: stock_putaway_product_template +#: model:ir.model,name:stock_putaway_product_template.model_product_template +msgid "Product Template" +msgstr "Plantilla de 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" diff --git a/stock_putaway_product_template/i18n/stock_putaway_product_template.pot b/stock_putaway_product_template/i18n/stock_putaway_product_template.pot index 9532dcbd4..7aadad79a 100644 --- a/stock_putaway_product_template/i18n/stock_putaway_product_template.pot +++ b/stock_putaway_product_template/i18n/stock_putaway_product_template.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/stock_putaway_product_template/models/stock_location.py b/stock_putaway_product_template/models/stock_location.py index f2442e763..48e66e2f6 100644 --- a/stock_putaway_product_template/models/stock_location.py +++ b/stock_putaway_product_template/models/stock_location.py @@ -7,7 +7,15 @@ from odoo import models class StockLocation(models.Model): _inherit = "stock.location" - def _get_putaway_strategy(self, product): + 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) + )._get_putaway_strategy( + product, + quantity=quantity, + package=package, + packaging=packaging, + additional_qty=additional_qty, + ) diff --git a/stock_putaway_product_template/models/stock_putaway_rule.py b/stock_putaway_product_template/models/stock_putaway_rule.py index 02a401ac8..8214de689 100644 --- a/stock_putaway_product_template/models/stock_putaway_rule.py +++ b/stock_putaway_product_template/models/stock_putaway_rule.py @@ -19,19 +19,28 @@ class StockPutawayRule(models.Model): @api.depends("product_id") def _compute_product_tmpl_id(self): for rec in self: - rec.product_tmpl_id = False 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": - rec.product_tmpl_id = params.get("id", False) + if params.get("model", "") == "product.template" and params.get("id"): + rec.product_tmpl_id = params.get("id") def filtered(self, func): - res = super(StockPutawayRule, self).filtered(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( diff --git a/stock_putaway_product_template/readme/CONTRIBUTORS.rst b/stock_putaway_product_template/readme/CONTRIBUTORS.rst index c8a035ba5..aa9327f79 100644 --- a/stock_putaway_product_template/readme/CONTRIBUTORS.rst +++ b/stock_putaway_product_template/readme/CONTRIBUTORS.rst @@ -6,3 +6,4 @@ * Sergio Teruel * Víctor Martínez + * César A. Sánchez diff --git a/stock_putaway_product_template/static/description/index.html b/stock_putaway_product_template/static/description/index.html index 135b50142..8f0d6316a 100644 --- a/stock_putaway_product_template/static/description/index.html +++ b/stock_putaway_product_template/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

This module add product template in putaway strategies from the product view to not need defined putaway strategies for all variants.

Table of contents

@@ -396,7 +396,7 @@ ul.auto-toc {

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -417,6 +417,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Tecnativa:
    • Sergio Teruel
    • Víctor Martínez
    • +
    • César A. Sánchez
  • @@ -430,7 +431,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

    Current maintainers:

    kevinkhao sebastienbeau

    -

    This module is part of the OCA/stock-logistics-warehouse project on GitHub.

    +

    This module is part of the OCA/stock-logistics-warehouse project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.