Skip to content

Commit

Permalink
Merge pull request #2726 from ForgeFlow/13.0-mig-l10n_ch-script
Browse files Browse the repository at this point in the history
[13.0][MIG] l10n_ch
  • Loading branch information
pedrobaeza authored Sep 21, 2023
2 parents 6117635 + c8ab0c7 commit 1c5c8fd
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 16 deletions.
10 changes: 0 additions & 10 deletions addons/l10n_ch/migrations/13.0.10.0/noupdate_changes.xml

This file was deleted.

2 changes: 1 addition & 1 deletion addons/l10n_ch/migrations/13.0.11.0/noupdate_changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</record>
<record id="fiscal_position_template_import" model="account.fiscal.position.template">
<field name="auto_apply" eval="True"/>
<field name="sequence">1</field>
<!-- <field name="sequence">1</field>-->
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
---Models in module 'l10n_ch'---
---Fields in module 'l10n_ch'---
l10n_ch / account.invoice / l10n_ch_isr_number (char) : DEL
l10n_ch / account.invoice / l10n_ch_isr_sent (boolean) : DEL
l10n_ch / account.journal / invoice_reference_model (False): NEW selection_keys: ['ch', 'euro', 'odoo'], mode: modify
l10n_ch / account.move / l10n_ch_isr_number (char) : NEW isfunction: function, stored
l10n_ch / account.invoice / l10n_ch_isr_sent (boolean) : DEL
l10n_ch / account.move / l10n_ch_isr_sent (boolean) : NEW hasdefault
# DONE: post-migration: moved fields from invoice to move

l10n_ch / account.journal / invoice_reference_model (False): NEW selection_keys: ['ch', 'euro', 'odoo'], mode: modify
# NOTHING TO DO: new feature

l10n_ch / res.bank / l10n_ch_postal_chf (char) : DEL
l10n_ch / res.bank / l10n_ch_postal_eur (char) : DEL
l10n_ch / res.partner.bank / l10n_ch_isr_subscription_chf (char): NEW
l10n_ch / res.partner.bank / l10n_ch_isr_subscription_eur (char): NEW
# DONE: post-migration: moved fields from bank to partner bank

---XML records in module 'l10n_ch'---
DEL account.account.tag: l10n_ch.vat_tag_200
DEL account.account.tag: l10n_ch.vat_tag_220
Expand All @@ -34,6 +40,13 @@ DEL account.account.tag: l10n_ch.vat_tag_415
DEL account.account.tag: l10n_ch.vat_tag_420
DEL account.account.tag: l10n_ch.vat_tag_dedouanement
NEW account.account.template: l10n_ch.ch_coa_1101
# NOTHING TO DO

account.chart.template: l10n_ch.l10nch_chart_template (noupdate switched)
# DONE: pre-migration: switched noupdate

NEW account.fiscal.position.template: l10n_ch.fiscal_position_template_1 (noupdate)
NEW account.tax.group: l10n_ch.tax_group_tva_100
NEW account.tax.report.line: l10n_ch.account_tax_report_line_calc_impot
NEW account.tax.report.line: l10n_ch.account_tax_report_line_calc_impot_base
NEW account.tax.report.line: l10n_ch.account_tax_report_line_calc_impot_chiffre
Expand Down Expand Up @@ -70,11 +83,11 @@ NEW account.tax.report.line: l10n_ch.account_tax_report_line_chtax_900
NEW account.tax.report.line: l10n_ch.account_tax_report_line_chtax_910
NEW account.tax.report.line: l10n_ch.account_tax_report_line_chtax_autres_mouv
NEW account.tax.report.line: l10n_ch.account_tax_report_line_chtax_solde
NEW account.tax.template: l10n_ch.vat_100_import_invest
NEW account.tax.template: l10n_ch.vat_other_movements_900
NEW account.tax.template: l10n_ch.vat_other_movements_910
NEW ir.actions.act_window: account.action_move_out_invoice_type
DEL ir.actions.act_window: account.action_invoice_tree1
NEW ir.ui.view: l10n_ch.isr_partner_bank_tree
NEW ir.ui.view: l10n_ch.isr_partner_property_bank_tree
NEW ir.ui.view: l10n_ch.setup_bank_account_wizard_inherit
DEL ir.ui.view: l10n_ch.isr_res_bank_form
# NOTHING TO DO
33 changes: 33 additions & 0 deletions addons/l10n_ch/migrations/13.0.11.0/post-migration.py
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")
10 changes: 10 additions & 0 deletions addons/l10n_ch/migrations/13.0.11.0/pre-migration.py
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,
)
2 changes: 1 addition & 1 deletion odoo/openupgrade/doc/source/modules120-130.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ missing in the new release are marked with |del|.
+----------------------------------------------+-------------------------------------------------+
|l10n_ca | |
+----------------------------------------------+-------------------------------------------------+
|l10n_ch | |
|l10n_ch | Done |
+----------------------------------------------+-------------------------------------------------+
|l10n_cl | |
+----------------------------------------------+-------------------------------------------------+
Expand Down

0 comments on commit 1c5c8fd

Please sign in to comment.