Module
account_asset_management
Describe the bug
When generating the Financial Assets Report without specifying an asset_group_id, the report crashes with an Expected singleton error.
The issue occurs in version 17.0 when the code attempts to access error_dict[k].id and error_dict[k].display_name assuming that error_dict[k] contains a single record, while it may actually contain multiple account.asset records.
The traceback points to:
err_msg += "%s" % [
x[1] for x in [(error_dict[k].id, error_dict[k].display_name)]
]
which raises:
ValueError: Expected singleton: account.asset(...)
This appears to have already been fixed in 18.0 with:
err_msg += ", ".join(error_dict[k].mapped("display_name"))
To Reproduce
Affected versions:
Steps to reproduce the behavior:
- Install
account_asset_management.
- Create assets belonging to different asset groups.
- Open the Financial Assets Report wizard.
- Leave the
asset_group_id field empty.
- Generate the XLSX report.
Expected behavior
The report should be generated successfully when no asset_group_id is specified, or at least display a proper validation message.
It should not raise an Expected singleton exception when multiple assets are present in error_dict[k].
Additional context
Traceback:
Traceback (most recent call last):
...
File "/opt/odoo/src/addons/oca/account-financial-tools/account_asset_management/report/account_asset_report_xls.py", line 727, in _asset_report
x[1] for x in [(error_dict[k].id, error_dict[k].display_name)]
File "/opt/odoo/src/odoo/odoo/fields.py", line 5187, in __get__
raise ValueError("Expected singleton: %s" % record)
ValueError: Expected singleton: account.asset(4057, 4038, 3979, 4010, 3698, ...)
The implementation in 18.0 has already been updated to:
err_msg += ", ".join(error_dict[k].mapped("display_name"))
which correctly handles multiple records and seems to resolve the issue.
Module
account_asset_management
Describe the bug
When generating the Financial Assets Report without specifying an
asset_group_id, the report crashes with anExpected singletonerror.The issue occurs in version 17.0 when the code attempts to access
error_dict[k].idanderror_dict[k].display_nameassuming thaterror_dict[k]contains a single record, while it may actually contain multipleaccount.assetrecords.The traceback points to:
which raises:
This appears to have already been fixed in 18.0 with:
To Reproduce
Affected versions:
Steps to reproduce the behavior:
account_asset_management.asset_group_idfield empty.Expected behavior
The report should be generated successfully when no
asset_group_idis specified, or at least display a proper validation message.It should not raise an
Expected singletonexception when multiple assets are present inerror_dict[k].Additional context
Traceback:
The implementation in 18.0 has already been updated to:
which correctly handles multiple records and seems to resolve the issue.