[FIX] analytic: error when you tab through the fields on a vendor bill

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) <wan@odoo.com>
This commit is contained in:
kdeb@odoo.com
2024-01-09 20:51:43 +00:00
parent 338173e231
commit 5860b086c0
@@ -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;
}