forked from OCA/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OCA#2726 from ForgeFlow/13.0-mig-l10n_ch-script
[13.0][MIG] l10n_ch
- Loading branch information
Showing
6 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2021 ForgeFlow <http://www.forgeflow.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def move_from_invoices_to_moves(env): | ||
openupgrade.logged_query( | ||
env.cr, """ | ||
UPDATE account_move am | ||
SET l10n_ch_isr_number = ai.l10n_ch_isr_number, | ||
l10n_ch_isr_sent = ai.l10n_ch_isr_sent | ||
FROM account_invoice ai | ||
WHERE am.old_invoice_id = ai.id""", | ||
) | ||
|
||
|
||
def move_from_bank_to_partner_bank(env): | ||
openupgrade.logged_query( | ||
env.cr, """ | ||
UPDATE res_partner_bank rpb | ||
SET l10n_ch_isr_subscription_chf = rb.l10n_ch_postal_chf, | ||
l10n_ch_isr_subscription_eur = rb.l10n_ch_postal_eur | ||
FROM res_bank rb | ||
WHERE rpb.bank_id = rb.id""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
move_from_invoices_to_moves(env) | ||
move_from_bank_to_partner_bank(env) | ||
openupgrade.load_data( | ||
env.cr, "l10n_ch", "migrations/13.0.11.0/noupdate_changes.xml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2021 ForgeFlow <http://www.forgeflow.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.set_xml_ids_noupdate_value( | ||
env, "l10n_ch", ["l10nch_chart_template"], False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters