Skip to content

Commit 21e02dd

Browse files
committed
Merge PR #370 into 18.0
Signed-off-by sergiocorato
2 parents 8b6dfc4 + 3babcf7 commit 21e02dd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

account_fiscal_year_closing/migrations/18.0.1.0.0/post-migrate.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def migrate(cr, version):
3131
)
3232

3333
for config in env["account.fiscalyear.closing.config.template"].search([]):
34+
if config.template_id:
35+
continue
3436
company = config.journal_id.company_id
3537
template = env["account.fiscalyear.closing.template"].search(
3638
[
@@ -39,9 +41,12 @@ def migrate(cr, version):
3941
],
4042
limit=1,
4143
)
42-
config.write({"template_id": template.id})
44+
if template:
45+
config.write({"template_id": template.id})
4346

4447
for closing in env["account.fiscalyear.closing"].search([]):
48+
if closing.closing_template_id:
49+
continue
4550
company = closing.company_id
4651
template = env["account.fiscalyear.closing.template"].search(
4752
[
@@ -50,4 +55,5 @@ def migrate(cr, version):
5055
],
5156
limit=1,
5257
)
53-
closing.write({"closing_template_id": template.id})
58+
if template:
59+
closing.write({"closing_template_id": template.id})

0 commit comments

Comments
 (0)