From 6b21d99c6151457738a908b7da4cecb174b672f3 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 11 Nov 2019 20:38:54 +0100 Subject: [PATCH] [MIG] contract: No contract on AA without recurring invoices flag Don't transfer to contract those analytic accounts with the "Recurring invoicing" flag unchecked. --- contract/migrations/12.0.4.0.0/pre-migration.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contract/migrations/12.0.4.0.0/pre-migration.py b/contract/migrations/12.0.4.0.0/pre-migration.py index dad488eb..70ff3aaa 100644 --- a/contract/migrations/12.0.4.0.0/pre-migration.py +++ b/contract/migrations/12.0.4.0.0/pre-migration.py @@ -97,6 +97,7 @@ def create_contract_records(cr): INSERT INTO contract_contract SELECT * FROM account_analytic_account WHERE id IN (SELECT DISTINCT {} FROM contract_line) + AND recurring_invoices """).format( sql.Identifier(contract_field_name), ), @@ -120,6 +121,7 @@ def create_contract_records(cr): UPDATE {table} SET {model_column}='contract.contract' WHERE {model_column}='account.analytic.account' AND {id_column} IN (SELECT DISTINCT {col} FROM contract_line) + AND recurring_invoices """).format( table=sql.Identifier(table), model_column=sql.Identifier(model_column),