From f701070177de84ee1cabd990d1b85ffc5dcd79f4 Mon Sep 17 00:00:00 2001 From: wan Date: Tue, 16 Jul 2019 09:35:02 +0000 Subject: [PATCH] [IMP] account: display the product in the name_get of account.move.line It is difficult to select an account.move.line of an invoice if there is a product but no label on the line. By showing the name of the product, we know what line we are choosing closes odoo/odoo#37596 X-original-commit: cf53f9c1909f85bdcb34f9acf79df1c8dc2a2da5 Signed-off-by: Quentin De Paoli (qdp) --- addons/account/models/account_move.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index bc5d9472770..75af584b56b 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3215,10 +3215,11 @@ class AccountMoveLine(models.Model): def name_get(self): result = [] for line in self: + name = line.move_id.name or '' if line.ref: - result.append((line.id, (line.move_id.name or '') + '(' + line.ref + ')')) - else: - result.append((line.id, line.move_id.name)) + name += " (%s)" % line.ref + name += (line.name or line.product_id.display_name) and (' ' + (line.name or line.product_id.display_name)) or '' + result.append((line.id, name)) return result # -------------------------------------------------------------------------