Contributors mailing list archives

Browse archives


Question about migration of and related entity (in my case on l10n_be)

Coop IT Easy SC agréée, Rémy Taymans
- 21/11/2022 16:02:05
Dear community,

I'm currently migrating a database from version 9.0 to version 14.0.
My problem is between 12.0 and 13.0 where accounting element has

The database is using Mis Builder to generate accounting reports. These
reports are based on account.account.tag that are linked to
(and also account.move.line in 13.0).

As I have seen, in 9.0 (and until 12.0), account.account.tag are linked
to an via a simple field tag_ids :

Starting from 13.0, tags are no more linked to directly.
They are linked to an which is linked to an

In 13.0, the account.chart.template has been updated accordingly.

As is, the migration did not succeed. At some point, odoo try
to remove the old account.tag. But that's not possible because these
tags are linked to existing account.move.line.

To avoid such deletetion, I flagged existing account.account.tag as

When migrating the database the existing all account.account.tag linked
to the are moved to all the of
the Meaning that if there is account.account.tag named
"03", "49", "54" that are all linked to an After migration
each line of will have "03", "49" and "54"
as tags.

This does not reflect the new account.chart.template for belgium.

So my first intention was to update the, particulary their to replace the old account.account.tag by
the new one created during the migration. Using the new
account.chart.template as an example. But that does not works, because
existing account.move.line always points to the old account.account.tag.

I have no idea how to update the tags on the account.move.line to
reflects the new account.chart.template and the new tags.

I tried to find the logic that computes tags on an account.move.line.
But it's really obscure for me. And simply applying the following
recompute method does not works (it causses issue about non balanced
account element):

Anther option is to map the old tags to the new one. But here comes the
problem that there is more new tags than old ones. So that I'm not sure
how to perform the mapping. For example the following records:
In 13.0 the account.account.tag created have sign. There exist two
version for the tag 03:
SELECT name, applicability, tax_negate
FROM account_account_tag WHERE name ILIKE '%03';
           name            | applicability | tax_negate
 Belgium VAT Form: grid 03 | taxes         |               <- the old one
 -03                       | taxes         | t             <-|
 +03                       | taxes         | f             <-L the two new ones
(3 rows)

Should I replace the old "03" tag by the "+03" one, or should I
sometimes replace it by the "-03" and when ?

When this will be solved, I will still be wondering if such a line is
ok ?
SELECT account_move_line_id, name
FROM account_account_tag_account_move_line_rel AS aatamlr
JOIN account_account_tag AS aat
ON aatamlr.account_account_tag_id =
WHERE account_move_line_id = 9166;
 account_move_line_id |           name
                 9166 | Belgium VAT Form: grid 03
                 9166 | Belgium VAT Form: grid 54
                 9166 | Belgium VAT Form: grid 49
                 9166 | Belgium VAT Form: grid 64

Where we see that an account.move.line is linked to 4 differents

I also take a look at this:
But it does not seams to solve the previous issue.

And finaly I looked at account_chart_update module, but it did not seams to solve the previous issues niether.

If you have any clue, it will be very helpfull. :)


Rémy Taymans @ Coop IT Easy
+32 493 02 69 85 - <>