odoo/odoo#201560

Created by Accounting, Maira Salazar
Merged at 964fcf7fb77eb6cf3931ec65fa0cd3cff48b3ab1

Statuses:

label
odoo-dev:18.0-fix-mandatory-analytic-plans-srma
head
bc48a7d431aa93aa3a51418057ef29a0feaf6074
merged
7 months ago by Accounting, Paolo Gatti (pgi)
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

[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