OCA / openupgradelib

A library with support functions to be called from Odoo migration scripts.
GNU Affero General Public License v3.0
85 stars 171 forks source link

[ADD] openupgrade_160: fill_analytic_distribution #350

Closed pedrobaeza closed 10 months ago

pedrobaeza commented 10 months ago

Convert v15 analytic tags with distributions to v16 analytic distributions.

Extracted and adapted from Viindoo original queries in their migration scripts.

@Tecnativa

pedrobaeza commented 10 months ago

It's already used successfully in account, which I already generalize a bit:

https://github.com/OCA/OpenUpgrade/blob/95a57861be937e9dc0bef2d56761a6c4e9e1b08a/openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py#L329

Being needed also in sale, purchase, and so on, I'm extracting it and generalizing for not repeating code. If any patch is needed, then we only need to touch in one place.

Merging then and next step is to test it replacing in account the code by the call to this.

marielejeune commented 9 months ago

Hi @pedrobaeza, thanks for extracting this method. It is sadly not working for sale order lines because sale_order_line has no line analytic_account_id. This column is on the related sale.order. Any idea on how to integrate this in the sale module migration? See my comment here: https://github.com/OCA/OpenUpgrade/pull/4240#discussion_r1409470410