From 69c403fd39e328f81c7f65e0a1a3a8fe64595daf Mon Sep 17 00:00:00 2001 From: David Date: Thu, 12 Dec 2024 11:45:42 +0100 Subject: [PATCH] [IMP] stock_picking_report_custom_description: update description Before this change only when the procurements where updated the sale line description would be propagated so if a user updated that description after the sale was confirmed it wouldn't be written to the picking move. Now every time the user changes the line it will be synced to the related moves. TT52171 --- .../README.rst | 1 + .../models/__init__.py | 1 + .../models/sale_order_line.py | 16 ++++++++++++++++ .../readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 15 +++++++++------ ...st_stock_picking_report_custom_description.py | 5 +++++ 6 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 stock_picking_report_custom_description/models/sale_order_line.py diff --git a/stock_picking_report_custom_description/README.rst b/stock_picking_report_custom_description/README.rst index 82798cb..738d053 100644 --- a/stock_picking_report_custom_description/README.rst +++ b/stock_picking_report_custom_description/README.rst @@ -30,6 +30,7 @@ Stock Picking Report Custom Description This module transfers the sales order line description to the picking, 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** 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..e6d5488 --- /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"): + self.env["stock.move"].search( + [("sale_line_id", "in", self.ids)] + ).name = vals["name"] + return res diff --git a/stock_picking_report_custom_description/readme/DESCRIPTION.rst b/stock_picking_report_custom_description/readme/DESCRIPTION.rst index a2d382e..a6dcfc6 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 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/static/description/index.html b/stock_picking_report_custom_description/static/description/index.html index 41b3f09..11a42d9 100644 --- a/stock_picking_report_custom_description/static/description/index.html +++ b/stock_picking_report_custom_description/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -371,7 +371,8 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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, and -allows to print such text on the picking reports.

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

Table of contents