From 31ba2729557b203bfab7c1adfec0f5ea5347949a Mon Sep 17 00:00:00 2001 From: "Thomas Becquevort (thbe)" Date: Thu, 2 Nov 2023 11:47:20 +0100 Subject: [PATCH] [FIX] account: Traceback on studio opening in Amounts to Settle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: 1. Open the "Amounts to Settle" view of either the Customers of Vendors menu 2. Click on the Studio button on the top right of the window 3. A traceback appears. Issue/Feature this commits addresses: When on the "Amounts to Settle" view, when clicking on the Studio button, a traceback appears and the studio menu is not opened. This should not happen. Desired behavior after this commit is merged: This fix makes the event that would cause the error not possible anymore. The studio menu should always open and not cause that traceback anymore. closes odoo/odoo#140671 Signed-off-by: William André (wan) --- addons/account/models/account_move_line.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index 11ea9f7fdc8..927c17754d1 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -447,8 +447,9 @@ class AccountMoveLine(models.Model): def get_views(self, views, options=None): res = super().get_views(views, options) if res['views'].get('list') and self.env['ir.ui.view'].browse(res['views']['list']['id']).name == "account.move.line.payment.tree": - # We dont want any additionnal action in the "account.move.line.payment.tree" view toolbar - res['views']['list']['toolbar']['action'] = [] + if toolbar := res['views']['list'].get('toolbar'): + # We dont want any additionnal action in the "account.move.line.payment.tree" view toolbar + toolbar['action'] = [] return res # -------------------------------------------------------------------------