File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
addons/l10n_es/migrations/13.0.4.0
odoo/addons/openupgrade_records/lib Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright 2020 ForgeFlow <http://www.forgeflow.com>
2+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+ from openupgradelib import openupgrade
5+
6+
7+ def set_account_move_number_to_invoice_number (env ):
8+ """l10n_es_account_invoice_sequence introduced different numbering between
9+ invoices and account moves.
10+ As long as we have only account_moves in version 13 we have to choose one.
11+ In case that module is installed we trust the sequence of the invoice
12+ """
13+ openupgrade .logged_query (
14+ env .cr , """
15+ UPDATE account_move am0 SET name = ai.invoice_number
16+ FROM account_invoice ai INNER JOIN account_move am
17+ ON ai.move_id = am.id
18+ WHERE ai.invoice_number is not null
19+ AND am.id = am0.id
20+ """
21+ )
22+
23+
24+ @openupgrade .migrate ()
25+ def migrate (env , version ):
26+ if openupgrade .column_exists (
27+ env .cr , "account_invoice" , "invoice_number" ):
28+ set_account_move_number_to_invoice_number (env )
Original file line number Diff line number Diff line change 4747 # OCA/website
4848 'website_canonical_url' : 'website' ,
4949 'website_logo' : 'website' ,
50+ # OCA/l10n-spain
51+ 'l10n_es_account_invoice_sequence' : 'l10n_es' ,
5052}
5153
5254# only used here for openupgrade_records analysis:
You can’t perform that action at this time.
0 commit comments