diff --git a/stock_picking_report_custom_description/README.rst b/stock_picking_report_custom_description/README.rst new file mode 100644 index 0000000..4253405 --- /dev/null +++ b/stock_picking_report_custom_description/README.rst @@ -0,0 +1,104 @@ +======================================= +Stock Picking Report Custom Description +======================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1eff22936a67f460be98ac827d2f198476094c35dc4d98db4290b618b971af4c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |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--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/17.0/stock_picking_report_custom_description + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-17-0/stock-logistics-reporting-17-0-stock_picking_report_custom_description + :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-reporting&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module transfers the sales order line description to the picking +description, and allows to print such text on the picking reports. When +the sales order line description is changed, picking description is +updated. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +1. Create a sale order and set manual description in sale order lines. +2. Confirm the order. +3. Navigate to the delivery through the smart-button. +4. You can check sales order line description is the same as description + picking + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__: + + - Carlos Dauden + - Sergio Teruel + - Ernesto Tejeda + - Pilar Vargas + - 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-carlosdauden| image:: https://github.com/carlosdauden.png?size=40px + :target: https://github.com/carlosdauden + :alt: carlosdauden + +Current `maintainer `__: + +|maintainer-carlosdauden| + +This module is part of the `OCA/stock-logistics-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_report_custom_description/__init__.py b/stock_picking_report_custom_description/__init__.py new file mode 100644 index 0000000..02179fb --- /dev/null +++ b/stock_picking_report_custom_description/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import models diff --git a/stock_picking_report_custom_description/__manifest__.py b/stock_picking_report_custom_description/__manifest__.py new file mode 100644 index 0000000..98ad47d --- /dev/null +++ b/stock_picking_report_custom_description/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2017 Tecnativa - Carlos Dauden +# Copyright 2018 Tecnativa - Vicent Cubells +# Copyright 2018 Tecnativa - Sergio Teruel +# Copyright 2023 Tecnativa - Carolina Fernandez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Picking Report Custom Description", + "summary": "Show moves description in picking reports", + "version": "17.0.1.0.0", + "category": "Warehouse", + "website": "https://github.com/OCA/stock-logistics-reporting", + "author": "Tecnativa, Odoo Community Association (OCA)", + "development_status": "Production/Stable", + "maintainers": ["carlosdauden"], + "license": "AGPL-3", + "depends": [ + "sale_stock", + ], + "data": [], +} diff --git a/stock_picking_report_custom_description/i18n/es.po b/stock_picking_report_custom_description/i18n/es.po new file mode 100644 index 0000000..bfe0a34 --- /dev/null +++ b/stock_picking_report_custom_description/i18n/es.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_custom_description +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-12-04 15:34+0000\n" +"PO-Revision-Date: 2023-10-15 20:37+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: stock_picking_report_custom_description +#: model:ir.model,name:stock_picking_report_custom_description.model_sale_order_line +msgid "Sales Order Line" +msgstr "Línea de Orden de Venta" + +#. module: stock_picking_report_custom_description +#: model:ir.model,name:stock_picking_report_custom_description.model_stock_rule +msgid "Stock Rule" +msgstr "Regla de Existencias" + +#~ msgid "Delivery Slip (Description)" +#~ msgstr "Vale de entrega (descripción)" + +#~ msgid "Picking Operations (Description)" +#~ msgstr "Operaciones de picking (descripción)" + +#~ msgid "Description" +#~ msgstr "Descripción" + +#~ msgid "Qty" +#~ msgstr "Ctd." + +#~ msgid "Packing Operation" +#~ msgstr "Operación de empaquetado" + +#~ msgid "Several product description" +#~ msgstr "Varias descripciones de producto" diff --git a/stock_picking_report_custom_description/i18n/it.po b/stock_picking_report_custom_description/i18n/it.po new file mode 100644 index 0000000..da77495 --- /dev/null +++ b/stock_picking_report_custom_description/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_custom_description +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-11-24 17:33+0000\n" +"Last-Translator: mymage \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_picking_report_custom_description +#: model:ir.model,name:stock_picking_report_custom_description.model_sale_order_line +msgid "Sales Order Line" +msgstr "Riga ordine di vendita" + +#. module: stock_picking_report_custom_description +#: model:ir.model,name:stock_picking_report_custom_description.model_stock_rule +msgid "Stock Rule" +msgstr "Regola di giacenza" diff --git a/stock_picking_report_custom_description/i18n/stock_picking_report_custom_description.pot b/stock_picking_report_custom_description/i18n/stock_picking_report_custom_description.pot new file mode 100644 index 0000000..5d28c20 --- /dev/null +++ b/stock_picking_report_custom_description/i18n/stock_picking_report_custom_description.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_custom_description +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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_picking_report_custom_description +#: model:ir.model,name:stock_picking_report_custom_description.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: stock_picking_report_custom_description +#: model:ir.model,name:stock_picking_report_custom_description.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/stock_picking_report_custom_description/models/__init__.py b/stock_picking_report_custom_description/models/__init__.py new file mode 100644 index 0000000..0745213 --- /dev/null +++ b/stock_picking_report_custom_description/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import stock_rule +from . import sale_order_line diff --git a/stock_picking_report_custom_description/models/sale_order_line.py b/stock_picking_report_custom_description/models/sale_order_line.py new file mode 100644 index 0000000..b2f7864 --- /dev/null +++ b/stock_picking_report_custom_description/models/sale_order_line.py @@ -0,0 +1,14 @@ +# Copyright 2023 Tecnativa - Carolina Fernandez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + def write(self, vals): + res = super().write(vals) + if vals.get("name"): + self.move_ids.description_picking = vals["name"] + return res diff --git a/stock_picking_report_custom_description/models/stock_rule.py b/stock_picking_report_custom_description/models/stock_rule.py new file mode 100644 index 0000000..43417cb --- /dev/null +++ b/stock_picking_report_custom_description/models/stock_rule.py @@ -0,0 +1,45 @@ +# Copyright 2022 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class StockRule(models.Model): + _inherit = "stock.rule" + + def _get_stock_move_values( + self, + product_id, + product_qty, + product_uom, + location_id, + name, + origin, + company_id, + values, + ): + """Transfer the SO line description to the move name.""" + res = super()._get_stock_move_values( + product_id, + product_qty, + product_uom, + location_id, + name, + origin, + company_id, + values, + ) + if values.get("sale_line_id"): + line = self.env["sale.order.line"].browse(values["sale_line_id"]) + # Avoid double printing the name in the picking + pattern = f"{line.product_id.display_name}\n" + description_picking = line.name + if description_picking.startswith(pattern): + description_picking = description_picking.replace(pattern, "") + if ( + description_picking + and description_picking != line.product_id.display_name + ): + res["description_picking"] = description_picking + res["name"] = line.name + return res diff --git a/stock_picking_report_custom_description/pyproject.toml b/stock_picking_report_custom_description/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/stock_picking_report_custom_description/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_picking_report_custom_description/readme/CONTRIBUTORS.md b/stock_picking_report_custom_description/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..606bbad --- /dev/null +++ b/stock_picking_report_custom_description/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- [Tecnativa](https://www.tecnativa.com): + - Carlos Dauden + - Sergio Teruel + - Ernesto Tejeda + - Pilar Vargas + - Carolina Fernandez diff --git a/stock_picking_report_custom_description/readme/DESCRIPTION.md b/stock_picking_report_custom_description/readme/DESCRIPTION.md new file mode 100644 index 0000000..f0edc70 --- /dev/null +++ b/stock_picking_report_custom_description/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module transfers the sales order line description to the picking +description, and allows to print such text on the picking reports. When +the sales order line description is changed, picking description is +updated. diff --git a/stock_picking_report_custom_description/readme/USAGE.md b/stock_picking_report_custom_description/readme/USAGE.md new file mode 100644 index 0000000..825476a --- /dev/null +++ b/stock_picking_report_custom_description/readme/USAGE.md @@ -0,0 +1,7 @@ +To use this module, you need to: + +1. Create a sale order and set manual description in sale order lines. +2. Confirm the order. +3. Navigate to the delivery through the smart-button. +4. You can check sales order line description is the same as + description picking diff --git a/stock_picking_report_custom_description/static/description/icon.png b/stock_picking_report_custom_description/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/stock_picking_report_custom_description/static/description/icon.png differ diff --git a/stock_picking_report_custom_description/static/description/index.html b/stock_picking_report_custom_description/static/description/index.html new file mode 100644 index 0000000..58175c9 --- /dev/null +++ b/stock_picking_report_custom_description/static/description/index.html @@ -0,0 +1,447 @@ + + + + + +Stock Picking Report Custom Description + + + +
+

Stock Picking Report Custom Description

+ + +

Production/Stable License: AGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runboat

+

This module transfers the sales order line description to the picking +description, and allows to print such text on the picking reports. When +the sales order line description is changed, picking description is +updated.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Create a sale order and set manual description in sale order lines.
  2. +
  3. Confirm the order.
  4. +
  5. Navigate to the delivery through the smart-button.
  6. +
  7. You can check sales order line description is the same as description +picking
  8. +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Carlos Dauden
    • +
    • Sergio Teruel
    • +
    • Ernesto Tejeda
    • +
    • Pilar Vargas
    • +
    • Carolina Fernandez
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

carlosdauden

+

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

+

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

+
+
+
+ + diff --git a/stock_picking_report_custom_description/tests/__init__.py b/stock_picking_report_custom_description/tests/__init__.py new file mode 100644 index 0000000..21aa35c --- /dev/null +++ b/stock_picking_report_custom_description/tests/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import test_stock_picking_report_custom_description diff --git a/stock_picking_report_custom_description/tests/test_stock_picking_report_custom_description.py b/stock_picking_report_custom_description/tests/test_stock_picking_report_custom_description.py new file mode 100644 index 0000000..fefb17b --- /dev/null +++ b/stock_picking_report_custom_description/tests/test_stock_picking_report_custom_description.py @@ -0,0 +1,35 @@ +# Copyright 2022 Tecnativa - Pedro M. Baeza +# Copyright 2023 Tecnativa - Carolina Fernandez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import common + + +class TestStockPickingReportCustomDescription(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.customer = cls.env["res.partner"].create({"name": "Test customer"}) + cls.product = cls.env["product.product"].create( + { + "name": "Test product", + "type": "product", + "description_sale": "Custom description", + } + ) + order_form = common.Form(cls.env["sale.order"]) + order_form.partner_id = cls.customer + with order_form.order_line.new() as line_form: + line_form.product_id = cls.product + cls.order = order_form.save() + + def test_so_custom_description_transfer_to_picking(self): + self.order.action_confirm() + self.assertEqual( + self.order.order_line.move_ids.description_picking, "Custom description" + ) + self.order.order_line.name = "Custom description 2" + self.assertEqual( + self.order.order_line.move_ids.description_picking, + self.order.order_line.name, + )