mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[OU-FIX] contract: Don't alter v12 recurrence mechanism + Transfer contract info from invoice
We can't guarantee the homogeneity of the existing contracts, so we keep the line recurrence behavior.
This commit is contained in:
committed by
Christopher Rogos
parent
88d82f4e21
commit
b137995193
@@ -11,7 +11,7 @@
|
||||
|
||||
{
|
||||
"name": "Recurring - Contracts Management",
|
||||
"version": "13.0.2.3.5",
|
||||
"version": "13.0.2.3.6",
|
||||
"category": "Contract Management",
|
||||
"license": "AGPL-3",
|
||||
"author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2020 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2020-2021 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openupgradelib import openupgrade # pylint: disable=W7936
|
||||
@@ -6,6 +6,28 @@ from openupgradelib import openupgrade # pylint: disable=W7936
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
openupgrade.logged_query(
|
||||
env.cr,
|
||||
"""
|
||||
UPDATE account_move am
|
||||
SET old_contract_id = ai.old_contract_id
|
||||
FROM account_invoice ai
|
||||
WHERE ai.id = am.old_invoice_id
|
||||
AND ai.old_contract_id IS NOT NULL""",
|
||||
)
|
||||
openupgrade.logged_query(
|
||||
env.cr,
|
||||
"""
|
||||
UPDATE account_move_line aml
|
||||
SET contract_line_id = ail.contract_line_id
|
||||
FROM account_invoice_line ail
|
||||
WHERE ail.id = aml.old_invoice_line_id
|
||||
AND ail.contract_line_id IS NOT NULL""",
|
||||
)
|
||||
openupgrade.load_data(
|
||||
env.cr, "contract", "migrations/13.0.1.0.0/noupdate_changes.xml"
|
||||
)
|
||||
|
||||
# Don't alter line recurrence v12 behavior
|
||||
contracts = env["contract.contract"].search([])
|
||||
contracts.write({"line_recurrence": True})
|
||||
|
||||
Reference in New Issue
Block a user