Skip to content
Snippets Groups Projects
Commit e0df7caf authored by Yolann Sabaux's avatar Yolann Sabaux
Browse files

[FIX] account: enforce contraint on required field for cash rounding


Steps to reproduce:
- install l10n_be (company B)
- stay on Company A and create a cash rounding
- Go to Company B and create an invoice
- In Other Infos > Cash Rouding Method, set it to the earlier created one
- Save

Issue:
You won't be able to save. But the message is too generic to know what is the cause of it
"Missing required account on accountable invoice line."

Cause:
The field `profit_account_id` is company_dependent. Therefore, the same cash rounding record will be accessible in both companies but in Company B the `profit_account_id` won't be set.
When Saving, we compute a cash difference (rounding) and try to create a new line for it. But since there is no account set, the sql constraint will be raised.

Solution:
The less dirty solution is to have an onchange that check that whenever we want to set a cash rounding method, it has all the required fields set

opw-3185950

closes odoo/odoo#122949

X-original-commit: 2092e8a76024ee1a818cc58e5675f5b0fa3037b6
Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
Signed-off-by: default avatarYolann Sabaux (yosa) <yosa@odoo.com>
parent 5a915f15
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment