From ec0bb71531c985d7ff84a7fb1e5319e8e6324708 Mon Sep 17 00:00:00 2001 From: Carolina Fernandez Date: Thu, 21 Sep 2023 08:47:53 -0300 Subject: [PATCH] [MIG] stock_picking_report_custom_description: Migration to 16.0 --- .../__manifest__.py | 9 +-- .../models/__init__.py | 1 + .../models/sale_order_line.py | 16 +++++ .../models/stock_rule.py | 1 + .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 3 +- .../readme/USAGE.rst | 6 +- .../static/description/index.html | 1 + ...stock_picking_report_custom_description.py | 10 ++- .../views/report_deliveryslip.xml | 62 ------------------- .../views/report_stockpicking_operations.xml | 18 ------ .../views/stock_report.xml | 29 --------- 12 files changed, 35 insertions(+), 122 deletions(-) create mode 100644 stock_picking_report_custom_description/models/sale_order_line.py delete mode 100644 stock_picking_report_custom_description/views/report_deliveryslip.xml delete mode 100644 stock_picking_report_custom_description/views/report_stockpicking_operations.xml delete mode 100644 stock_picking_report_custom_description/views/stock_report.xml diff --git a/stock_picking_report_custom_description/__manifest__.py b/stock_picking_report_custom_description/__manifest__.py index d881d1d..a0a6f6b 100644 --- a/stock_picking_report_custom_description/__manifest__.py +++ b/stock_picking_report_custom_description/__manifest__.py @@ -1,12 +1,13 @@ # 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": "15.0.1.0.0", + "version": "16.0.1.0.0", "category": "Warehouse", "website": "https://github.com/OCA/stock-logistics-reporting", "author": "Tecnativa, Odoo Community Association (OCA)", @@ -16,9 +17,5 @@ "depends": [ "sale_stock", ], - "data": [ - "views/report_deliveryslip.xml", - "views/report_stockpicking_operations.xml", - "views/stock_report.xml", - ], + "data": [], } diff --git a/stock_picking_report_custom_description/models/__init__.py b/stock_picking_report_custom_description/models/__init__.py index c6e6e2f..0745213 100644 --- a/stock_picking_report_custom_description/models/__init__.py +++ b/stock_picking_report_custom_description/models/__init__.py @@ -1,2 +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..6883cba --- /dev/null +++ b/stock_picking_report_custom_description/models/sale_order_line.py @@ -0,0 +1,16 @@ +# 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"): + moves = self.env["stock.move"].search([("sale_line_id", "=", self.id)]) + if moves: + moves.write({"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 index 041dc83..0869659 100644 --- a/stock_picking_report_custom_description/models/stock_rule.py +++ b/stock_picking_report_custom_description/models/stock_rule.py @@ -31,5 +31,6 @@ class StockRule(models.Model): ) if values.get("sale_line_id"): line = self.env["sale.order.line"].browse(values["sale_line_id"]) + res["description_picking"] = line.name res["name"] = line.name return res diff --git a/stock_picking_report_custom_description/readme/CONTRIBUTORS.rst b/stock_picking_report_custom_description/readme/CONTRIBUTORS.rst index 0b7af09..82d59ed 100644 --- a/stock_picking_report_custom_description/readme/CONTRIBUTORS.rst +++ b/stock_picking_report_custom_description/readme/CONTRIBUTORS.rst @@ -4,3 +4,4 @@ * Sergio Teruel * Ernesto Tejeda * Pilar Vargas + * Carolina Fernandez diff --git a/stock_picking_report_custom_description/readme/DESCRIPTION.rst b/stock_picking_report_custom_description/readme/DESCRIPTION.rst index a2d382e..d36ec0e 100644 --- a/stock_picking_report_custom_description/readme/DESCRIPTION.rst +++ b/stock_picking_report_custom_description/readme/DESCRIPTION.rst @@ -1,2 +1,3 @@ -This module transfers the sales order line description to the picking, and +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.rst b/stock_picking_report_custom_description/readme/USAGE.rst index 66a59ec..2d894a0 100644 --- a/stock_picking_report_custom_description/readme/USAGE.rst +++ b/stock_picking_report_custom_description/readme/USAGE.rst @@ -3,8 +3,4 @@ To use this module, you need to: #. Create a sale order and set manual description in sale order lines. #. 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). +#. You can check sales order line description is the same as description picking diff --git a/stock_picking_report_custom_description/static/description/index.html b/stock_picking_report_custom_description/static/description/index.html index 41b3f09..ad9f177 100644 --- a/stock_picking_report_custom_description/static/description/index.html +++ b/stock_picking_report_custom_description/static/description/index.html @@ -424,6 +424,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Sergio Teruel
  • Ernesto Tejeda
  • Pilar Vargas
  • +
  • Carolina Fernandez
  • 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 index 84981cf..f906b29 100644 --- 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 @@ -1,4 +1,5 @@ # 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 @@ -21,4 +22,11 @@ class TestStockPickingReportCustomDescription(common.TransactionCase): def test_so_custom_description_transfer_to_picking(self): self.order.action_confirm() - self.assertEqual(self.order.order_line.move_ids.name, "Custom description") + 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, + ) diff --git a/stock_picking_report_custom_description/views/report_deliveryslip.xml b/stock_picking_report_custom_description/views/report_deliveryslip.xml deleted file mode 100644 index 4931ab4..0000000 --- a/stock_picking_report_custom_description/views/report_deliveryslip.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - diff --git a/stock_picking_report_custom_description/views/report_stockpicking_operations.xml b/stock_picking_report_custom_description/views/report_stockpicking_operations.xml deleted file mode 100644 index ac2701a..0000000 --- a/stock_picking_report_custom_description/views/report_stockpicking_operations.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - diff --git a/stock_picking_report_custom_description/views/stock_report.xml b/stock_picking_report_custom_description/views/stock_report.xml deleted file mode 100644 index 1465285..0000000 --- a/stock_picking_report_custom_description/views/stock_report.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - Picking Operations (Description) - stock.picking - qweb-pdf - stock_picking_report_custom_description.report_picking_description - stock_picking_report_custom_description.report_picking_operations_description - - report - - - Delivery Slip (Description) - stock.picking - qweb-pdf - stock_picking_report_custom_description.report_deliveryslip_description - stock_picking_report_custom_description.report_deliveryslip_description - - report - -