mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[REF] Contract Sale Invoicing: split from analytic account
[REF] Contract Sale Invoicing: update translations [IMP] - Assert that the predecessor is available for new link at uncancel [RMV] - remove usless changes [RMV] - Remove usless field recurring_invoices after the total isolation between contract model and account analytic one. recurring_invoices which was used to mark analytic account as contract became usless [IMP] - P3 syntax [IMP] - use @openupgrade.migrate() and openupgrade.logged_query [IMP] - drop transient table in migration script
This commit is contained in:
committed by
Francisco Ivan Anton Prieto
parent
3ca769e079
commit
c770e97adb
@@ -8,7 +8,16 @@ from openupgradelib import openupgrade
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
_logger.info(">> Pre-Migration 12.0.4.0.0")
|
||||
cr = env.cr
|
||||
openupgrade.logged_query(
|
||||
cr,
|
||||
"""
|
||||
DROP TABLE IF EXISTS account_analytic_invoice_line_wizard
|
||||
"""
|
||||
)
|
||||
models_to_rename = [
|
||||
# Contract Line Wizard
|
||||
('account.analytic.invoice.line.wizard', 'contract.line.wizard'),
|
||||
@@ -25,8 +34,6 @@ def migrate(cr, version):
|
||||
('account.analytic.contract.line', 'contract.template.line'),
|
||||
]
|
||||
tables_to_rename = [
|
||||
# Contract Line Wizard
|
||||
('account_analytic_invoice_line_wizard', 'contract_line_wizard'),
|
||||
# Contract Template
|
||||
('account_analytic_contract', 'contract_template'),
|
||||
# Contract Template Line
|
||||
@@ -53,19 +60,22 @@ def migrate(cr, version):
|
||||
openupgrade.rename_xmlids(cr, xmlids_to_rename)
|
||||
# A temporary column is needed to avoid breaking the foreign key constraint
|
||||
# The temporary column is dropped in the post-migration script
|
||||
cr.execute(
|
||||
openupgrade.logged_query(
|
||||
cr,
|
||||
"""
|
||||
ALTER TABLE account_invoice_line
|
||||
ADD COLUMN contract_line_id_tmp INTEGER
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
openupgrade.logged_query(
|
||||
cr,
|
||||
"""
|
||||
UPDATE account_invoice_line
|
||||
SET contract_line_id_tmp = contract_line_id
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
openupgrade.logged_query(
|
||||
cr,
|
||||
"""
|
||||
UPDATE account_invoice_line SET contract_line_id = NULL
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user