From 612551577253eb8dd378e28a2e2908809143203b Mon Sep 17 00:00:00 2001 From: GitHub Copilot Date: Thu, 28 May 2026 20:22:18 +0200 Subject: [PATCH] [IMP] stock_picking_batch_custom: order detailed ops by category, product, partner Override _order on stock.move.line using the existing stored Many2one fields. Odoo JOINs product.category and uses its _order (complete_name, which is stored) so the full category path is used for sorting without any extra fields. Co-Authored-By: Claude Sonnet 4.6 --- .../models/stock_move_line.py | 23 +------------------ .../views/stock_picking_batch_views.xml | 2 +- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/stock_picking_batch_custom/models/stock_move_line.py b/stock_picking_batch_custom/models/stock_move_line.py index cbf9400..bc75ed5 100644 --- a/stock_picking_batch_custom/models/stock_move_line.py +++ b/stock_picking_batch_custom/models/stock_move_line.py @@ -8,7 +8,7 @@ from odoo import models class StockMoveLine(models.Model): _inherit = "stock.move.line" - _order = "product_categ_complete_name, product_name, partner_name, id" + _order = "product_categ_id, product_id, picking_partner_id, id" product_categ_id = fields.Many2one( comodel_name="product.category", @@ -18,27 +18,6 @@ class StockMoveLine(models.Model): readonly=True, ) - product_categ_complete_name = fields.Char( - string="Product Category Path", - related="product_id.categ_id.complete_name", - store=True, - readonly=True, - ) - - product_name = fields.Char( - string="Product Name", - related="product_id.name", - store=True, - readonly=True, - ) - - partner_name = fields.Char( - string="Partner Name", - related="picking_id.partner_id.name", - store=True, - readonly=True, - ) - product_default_code = fields.Char( string="Product Code", related="product_id.default_code", diff --git a/stock_picking_batch_custom/views/stock_picking_batch_views.xml b/stock_picking_batch_custom/views/stock_picking_batch_views.xml index 56e23e8..d84b319 100644 --- a/stock_picking_batch_custom/views/stock_picking_batch_views.xml +++ b/stock_picking_batch_custom/views/stock_picking_batch_views.xml @@ -47,7 +47,7 @@ - product_categ_complete_name,product_name,partner_name + product_categ_id,product_id,picking_partner_id o_batch_move_line_list