odoo/odoo#203447

Created by fw-bot
Merged at 2018976559f7554971f9c3c872ece9601b2e640c

Statuses:

label
odoo-dev:saas-18.2-18.0-fix-mandatory-analytic-plans-srma-425381-fw
head
6850b6d2470baf96d2cfcae7813660b6dbf2cbdf
merged
7 months ago by Accounting, Maira Salazar
odoo/odoo
16.0 #201560
17.0 #203006
saas-17.4 #203153
18.0 #203194
saas-18.1 #203338
saas-18.2 #203447
saas-18.3
saas-18.4
19.0
master #203480

[FW][IMP] account: validate mandatory analytic plans when batch posting

When we have an Analytic Plan being Mandatory, confirming an invoice from the form view, if it has a line without an Analytic distribution, correctly raises a ValidationError.
Confirming invoices from the list view does not raise the same error, yet it should.

To replicate:
1. Activate Analytic accounting:
a. Install accountant
b. In Settings, activate Analytic Accounting
c. Create an Analytic plan (with an Analytic account associated)
2. Set its default applicability to mandatory
3. Create two invoices, remove the analytic distribution from one of the lines in one invoice.
4. In the invoices list view, select both newly created invoices, click on Actions > Confirm Entries
5. Click Confirm
6. The invoices were posted, even though they have no analytic distributions.

Ticket link
opw-4603919

Forward-Port-Of: #203338
Forward-Port-Of: #201560