Skip to content

Commit 92736b6

Browse files
committed
[OU-FIX] contract: Transfer contract info from invoice
1 parent 6d43d34 commit 92736b6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: contract/migrations/13.0.1.0.0/post-migration.py

+19
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,28 @@
66

77
@openupgrade.migrate()
88
def migrate(env, version):
9+
openupgrade.logged_query(
10+
env.cr,
11+
"""
12+
UPDATE account_move am
13+
SET old_contract_id = ai.old_contract_id
14+
FROM account_invoice ai
15+
WHERE ai.id = am.old_invoice_id
16+
AND ai.old_contract_id IS NOT NULL""",
17+
)
18+
openupgrade.logged_query(
19+
env.cr,
20+
"""
21+
UPDATE account_move_line aml
22+
SET contract_line_id = ail.contract_line_id
23+
FROM account_invoice_line ail
24+
WHERE ail.id = aml.old_invoice_line_id
25+
AND ail.contract_line_id IS NOT NULL""",
26+
)
927
openupgrade.load_data(
1028
env.cr, "contract", "migrations/13.0.1.0.0/noupdate_changes.xml"
1129
)
30+
1231
# Don't alter line recurrence v12 behavior
1332
contracts = env["contract.contract"].search([])
1433
contracts.write({"line_recurrence": True})

0 commit comments

Comments
 (0)