From 5860b086c0fea17a150c25af28fa35ac64d56321 Mon Sep 17 00:00:00 2001 From: "kdeb@odoo.com" Date: Tue, 2 Jan 2024 00:10:27 +0100 Subject: [PATCH] [FIX] analytic: error when you tab through the fields on a vendor bill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: - When you have analytic plans but no analytic accounts you got a traceback when you tab through the fields on a vendor bill. Steps to reproduce: - In accounting app create a vendor bill where analytic plans exist without associated analytic accounts. - Use the key 'Tab' to move through the fields on the vendor bill. - Notice Traceback error. Solution: - Checking if the dropdown is not empty before proceeding with the Tab key logic. OPW-3648815 closes odoo/odoo#147807 Signed-off-by: William André (wan) --- .../components/analytic_distribution/analytic_distribution.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js index 56e24695bf2..bd379523928 100644 --- a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js +++ b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js @@ -563,7 +563,8 @@ export class AnalyticDistribution extends Component { if (this.isDropdownOpen) { const closestCell = ev.target.closest("td, th"); const row = closestCell.parentElement; - if (this.adjacentElementToFocus("next") == this.addLineButton.el && this.lineIsValid(this.state.formattedData[parseInt(row.id)])) { + const line = this.state.formattedData[parseInt(row.id)]; + if (this.adjacentElementToFocus("next") == this.addLineButton.el && line && this.lineIsValid(line)) { this.addLine(); break; }