Skip to content

Commit e5e14c4

Browse files
[UPT]l10n_es
* if l10n_es_account_invoice_sequence is installed use invoice number as move number
1 parent ace5606 commit e5e14c4

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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)

odoo/addons/openupgrade_records/lib/apriori.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
'web_widget_color': 'web',
4444
# OCA/website
4545
'website_canonical_url': 'website',
46+
# OCA/l10n-spain
47+
'l10n_es_account_invoice_sequence': 'l10n_es',
4648
}
4749

4850
# only used here for openupgrade_records analysis:

0 commit comments

Comments
 (0)