-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] l10n_br_account_payment_brcobranca:CNAB Conf
- Loading branch information
Showing
10 changed files
with
161 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
l10n_br_account_payment_brcobranca/migrations/14.0.7.0.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (C) 2024-Today - Akretion (<http://www.akretion.com>). | ||
# @author Magno Costa <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def update_cnab_config(env): | ||
"""Atualiza a Configuração do CNAB""" | ||
env.cr.execute( | ||
""" | ||
SELECT id FROM account_payment_mode WHERE payment_method_id IN | ||
(SELECT id FROM account_payment_method WHERE code IN ('240', '400', '500') | ||
AND payment_type = 'inbound'); | ||
""" | ||
) | ||
for row in env.cr.fetchall(): | ||
payment_mode = env["account.payment.mode"].browse(row[0]) | ||
cnab_config = env["l10n_br_cnab.config"].search( | ||
[ | ||
("bank_id", "=", payment_mode.fixed_journal_id.bank_id.id), | ||
("payment_method_id", "=", payment_mode.payment_method_id.id), | ||
] | ||
) | ||
cnab_config.cnab_processor = payment_mode.cnab_processor | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
if not version: | ||
return | ||
update_cnab_config(env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.