Skip to content

Commit

Permalink
Merge pull request #223 from Engenere/14.0-unify_cnab_code_objects-pa…
Browse files Browse the repository at this point in the history
…tch1

[FIX] l10n_br_account_payment_order: add check in migration
  • Loading branch information
rvalyi authored Sep 10, 2024
2 parents 830aee6 + f7caee9 commit 6a94210
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 6a94210

Please sign in to comment.