Skip to content

Commit 02570b9

Browse files
committed
Merge PR #3593 into 16.0
Signed-off-by rvalyi
2 parents be49e28 + c629617 commit 02570b9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

l10n_br_account_payment_order/migrations/16.0.2.0.0/post-migration.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,18 @@ def migrate(env, version):
403403
if not version:
404404
return
405405

406-
# Verifica se já houve migração, banco de dados migrados na v14
407-
payment_mode_migrated = env["account.payment.mode"].search(
408-
[
409-
("sending_code_id", "!=", False),
410-
],
411-
limit=1,
412-
)
406+
if "sending_code_id" in env["account.payment.mode"]._fields:
407+
# Caso o campo ainda exista,
408+
# checamos se já há registros (indicando migração prévia).
409+
payment_mode_migrated = env["account.payment.mode"].search(
410+
[("sending_code_id", "!=", False)],
411+
limit=1,
412+
)
413+
else:
414+
# Caso o campo não exista,
415+
# assumimos que a migração já foi suficientemente avançada.
416+
payment_mode_migrated = True
417+
413418
if payment_mode_migrated:
414419
return
415420

0 commit comments

Comments
 (0)