From 1a159eca767fa731a43f928c75783fb23a7a40f4 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 13 Dec 2022 19:49:49 +0100 Subject: [PATCH] [FIX] stock_picking_report_custom_description: Transfer line description to move --- .../README.rst | 23 +++++--- .../__init__.py | 2 + .../__manifest__.py | 2 +- ...tock_picking_report_custom_description.pot | 7 ++- .../models/__init__.py | 2 + .../models/stock_rule.py | 35 ++++++++++++ .../readme/DESCRIPTION.rst | 3 +- .../readme/USAGE.rst | 9 +++- .../static/description/index.html | 53 +++++++++++-------- .../tests/__init__.py | 2 + ...stock_picking_report_custom_description.py | 24 +++++++++ 11 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 stock_picking_report_custom_description/models/__init__.py create mode 100644 stock_picking_report_custom_description/models/stock_rule.py create mode 100644 stock_picking_report_custom_description/tests/__init__.py create mode 100644 stock_picking_report_custom_description/tests/test_stock_picking_report_custom_description.py diff --git a/stock_picking_report_custom_description/README.rst b/stock_picking_report_custom_description/README.rst index 29c008f..82798cb 100644 --- a/stock_picking_report_custom_description/README.rst +++ b/stock_picking_report_custom_description/README.rst @@ -2,10 +2,13 @@ Stock Picking Report Custom Description ======================================= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:6c03fe3cfe5f5df1c21382b6b7e658d4b8cebecf53d1f5003cbb7817ff40f003 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png :target: https://odoo-community.org/page/development-status @@ -20,12 +23,13 @@ Stock Picking Report Custom Description :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-15-0/stock-logistics-reporting-15-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/webui/builds.html?repo=OCA/stock-logistics-reporting&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&target_branch=15.0 :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| -This module allows to print moves description in picking reports. +This module transfers the sales order line description to the picking, and +allows to print such text on the picking reports. **Table of contents** @@ -38,15 +42,20 @@ Usage To use this module, you need to: #. Create a sale order and set manual description in sale order lines. -#. Go to *Inventory > Deliveries* and you can print the reports with move name - instead product name. +#. Confirm the order. +#. Navigate to the delivery through the smart-button. +#. You can print the reports with move name instead product name on the specific + reports: + + * Delivery Slip (Description). + * Picking Operations (Description). 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 +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. diff --git a/stock_picking_report_custom_description/__init__.py b/stock_picking_report_custom_description/__init__.py index e69de29..02179fb 100644 --- a/stock_picking_report_custom_description/__init__.py +++ 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 index 0109abe..d881d1d 100644 --- a/stock_picking_report_custom_description/__manifest__.py +++ b/stock_picking_report_custom_description/__manifest__.py @@ -14,7 +14,7 @@ "maintainers": ["carlosdauden"], "license": "AGPL-3", "depends": [ - "stock", + "sale_stock", ], "data": [ "views/report_deliveryslip.xml", 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 index 1bb08a0..7c0eeab 100644 --- 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 @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -22,3 +22,8 @@ msgstr "" #: model:ir.actions.report,name:stock_picking_report_custom_description.action_report_picking_description msgid "Picking Operations (Description)" 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..c6e6e2f --- /dev/null +++ b/stock_picking_report_custom_description/models/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import stock_rule 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..041dc83 --- /dev/null +++ b/stock_picking_report_custom_description/models/stock_rule.py @@ -0,0 +1,35 @@ +# 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"]) + res["name"] = line.name + return res diff --git a/stock_picking_report_custom_description/readme/DESCRIPTION.rst b/stock_picking_report_custom_description/readme/DESCRIPTION.rst index ef441a5..a2d382e 100644 --- a/stock_picking_report_custom_description/readme/DESCRIPTION.rst +++ b/stock_picking_report_custom_description/readme/DESCRIPTION.rst @@ -1 +1,2 @@ -This module allows to print moves description in picking reports. +This module transfers the sales order line description to the picking, and +allows to print such text on the picking reports. diff --git a/stock_picking_report_custom_description/readme/USAGE.rst b/stock_picking_report_custom_description/readme/USAGE.rst index ab62328..66a59ec 100644 --- a/stock_picking_report_custom_description/readme/USAGE.rst +++ b/stock_picking_report_custom_description/readme/USAGE.rst @@ -1,5 +1,10 @@ To use this module, you need to: #. Create a sale order and set manual description in sale order lines. -#. Go to *Inventory > Deliveries* and you can print the reports with move name - instead product name. +#. Confirm the order. +#. Navigate to the delivery through the smart-button. +#. You can print the reports with move name instead product name on the specific + reports: + + * Delivery Slip (Description). + * Picking Operations (Description). diff --git a/stock_picking_report_custom_description/static/description/index.html b/stock_picking_report_custom_description/static/description/index.html index 049e756..41b3f09 100644 --- a/stock_picking_report_custom_description/static/description/index.html +++ b/stock_picking_report_custom_description/static/description/index.html @@ -1,20 +1,20 @@ - + - + Stock Picking Report Custom Description