[FIX] account: Traceback on studio opening in Amounts to Settle

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) <wan@odoo.com>
This commit is contained in:
Thomas Becquevort (thbe)
2023-11-03 16:43:36 +00:00
parent b1414d3c30
commit 31ba272955
+3 -2
View File
@@ -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
# -------------------------------------------------------------------------