From a83beb77b4a399a4d1a740b8a59d9d90820130f9 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Sat, 30 Jul 2016 18:56:36 +0200 Subject: [PATCH] [FIX] also write account_code_digits via sql if there's only one template --- addons/account/migrations/9.0.1.1/post-migration.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/account/migrations/9.0.1.1/post-migration.py b/addons/account/migrations/9.0.1.1/post-migration.py index 48595235a90b..159213277716 100644 --- a/addons/account/migrations/9.0.1.1/post-migration.py +++ b/addons/account/migrations/9.0.1.1/post-migration.py @@ -66,9 +66,14 @@ def account_templates(cr): # right one company.write({ 'chart_template_id': account_templates.id, - 'accounts_code_digits': accounts_code_digits, 'transfer_account_id': account_templates.transfer_account_id.id }) + # we need to write accounts_code_digits via sql because the orm + # would try to renumber existing accounts which we don't want + env.cr.execute( + 'update res_company set accounts_code_digits=%s ' + 'where id in %s', + (accounts_code_digits, tuple(company.ids))) continue # when there are multiple charts of accounts, things get messy. # we assign the chart of accounts with the most matches concerning