Skip to content

Commit

Permalink
[FIX] l10n_br_account_payment_order: add check in migration
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniospneto authored and rvalyi committed Sep 10, 2024
1 parent cff100f commit 00a8a72
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def unifying_cnab_codes(env):
)
for row in env.cr.fetchall():
mov_instruction = env["l10n_br_cnab.mov.instruction.code"].browse(row[0])
existing_code = env["l10n_br_cnab.code"].search(
[("code", "=", mov_instruction.code)], limit=1
)
if existing_code:
continue # Skip
env["l10n_br_cnab.code"].create(
{
"name": mov_instruction.name,
Expand All @@ -34,6 +39,11 @@ def unifying_cnab_codes(env):
)
for row in env.cr.fetchall():
return_code = env["l10n_br_cnab.return.move.code"].browse(row[0])
existing_code = env["l10n_br_cnab.code"].search(
[("code", "=", return_code.code)], limit=1
)
if existing_code:
continue # Skip
env["l10n_br_cnab.code"].create(
{
"name": return_code.name,
Expand All @@ -52,6 +62,11 @@ def unifying_cnab_codes(env):
)
for row in env.cr.fetchall():
wallet_code = env["l10n_br_cnab.boleto.wallet.code"].browse(row[0])
existing_code = env["l10n_br_cnab.code"].search(
[("code", "=", wallet_code.code)], limit=1
)
if existing_code:
continue # Skip
env["l10n_br_cnab.code"].create(
{
"name": wallet_code.name,
Expand Down

0 comments on commit 00a8a72

Please sign in to comment.