| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details |
| 2 |
from odoo import SUPERUSER_ID, api |
| 3 |
|
| 4 |
|
| 5 |
def migrate(cr, version): |
| 6 |
env = api.Environment(cr, SUPERUSER_ID, {}) |
| 7 |
tax_report = env.ref("l10n_de.tax_report", raise_if_not_found=False) |
| 8 |
balance_column = env.ref('l10n_de.tax_report_balance', raise_if_not_found=False) |
| 9 |
report_lines = [f"l10n_de.tax_report_de_tax_tag_{btw}" for btw in ["17", "18", "19", "31", "46", "55", "64"]] + [ |
| 10 |
f"l10n_de.tax_report_de_tag_{btw}" for btw in |
| 11 |
["01", "02", "17", "18", "19", "25", "26", "27", "31", "33", |
| 12 |
"34", "36", "37", "46", "47", "71", "74", "80", "85", "96", |
| 13 |
"98"]] |
| 14 |
report_lines = [env.ref(line, raise_if_not_found=False) for line in report_lines] |
| 15 |
report_line_ids = tuple(line.id for line in report_lines if line) |
| 16 |
|
| 17 |
if balance_column: |
| 18 |
cr.execute("DELETE FROM account_report_column WHERE id = %s", (balance_column.id,)) |
| 19 |
if report_line_ids: |
| 20 |
cr.execute("DELETE FROM account_report_line WHERE id IN %s", (report_line_ids,)) |
| 21 |
if tax_report: |
| 22 |
cr.execute("UPDATE account_report_line SET code = NULL WHERE report_id = %s", (tax_report.id,)) |