From 19138b2d5f2dc12fb2adc8af12a5b3f40c2cd91b Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 26 Nov 2024 10:56:59 +0100 Subject: [PATCH] [14.0][ADD] stock_move_line_description: When you change the description of the sales order line, also change the description of its stock movements. --- stock_move_line_description/__manifest__.py | 2 +- stock_move_line_description/models/__init__.py | 1 + .../models/sale_order_line.py | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 stock_move_line_description/models/sale_order_line.py diff --git a/stock_move_line_description/__manifest__.py b/stock_move_line_description/__manifest__.py index f6aa217ad3..ba40b4bfaf 100644 --- a/stock_move_line_description/__manifest__.py +++ b/stock_move_line_description/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Stock Move Line Description", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "author": "Avanzosc", "category": "Sale", "website": "https://github.com/avanzosc/odoo-addons", diff --git a/stock_move_line_description/models/__init__.py b/stock_move_line_description/models/__init__.py index 7fbfa5e3bf..5d8267ea02 100644 --- a/stock_move_line_description/models/__init__.py +++ b/stock_move_line_description/models/__init__.py @@ -1,2 +1,3 @@ from . import account_move from . import stock_move +from . import sale_order_line diff --git a/stock_move_line_description/models/sale_order_line.py b/stock_move_line_description/models/sale_order_line.py new file mode 100644 index 0000000000..af76e875e1 --- /dev/null +++ b/stock_move_line_description/models/sale_order_line.py @@ -0,0 +1,13 @@ +from odoo import api, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + def write(self, values): + result = super(SaleOrderLine, self).write(values) + if "name" in values: + for line in self: + if line.move_ids: + line.move_ids.write({"name": line.name}) + return result