-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_br_account_payment_order: wizard trigger CNAB info load af…
…ter posted
- Loading branch information
Showing
5 changed files
with
62 additions
and
0 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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import account_payment_line_create | ||
from . import account_move_line_change | ||
from . import account_move_payment_mode |
24 changes: 24 additions & 0 deletions
24
l10n_br_account_payment_order/wizards/account_move_payment_mode.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,24 @@ | ||
# Copyright 2024 - TODAY, Kaynnan Lemes <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
from ..constants import BR_CODES_PAYMENT_ORDER | ||
|
||
|
||
class AccountMovePaymentModeWizard(models.TransientModel): | ||
_name = "account.move.payment.mode.cnab.change" | ||
_description = "Account Move Payment Mode CNAB Wizard" | ||
|
||
payment_mode_id = fields.Many2one( | ||
"account.payment.mode", | ||
required=True, | ||
domain=lambda self: [("payment_method_code", "in", BR_CODES_PAYMENT_ORDER)], | ||
) | ||
|
||
def set_payment_mode(self): | ||
move_id = self.env.context.get("active_id") | ||
move = self.env["account.move"].browse(move_id) | ||
if move.state == "posted": | ||
move.payment_mode_id = self.payment_mode_id | ||
move.load_cnab_info() | ||
35 changes: 35 additions & 0 deletions
35
l10n_br_account_payment_order/wizards/account_move_payment_mode.xml
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,35 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2024 - TODAY, Kaynnan Lemes <[email protected]> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
|
||
<record id="account_move_payment_mode_cnab_change_wizard_form" model="ir.ui.view"> | ||
<field name="name">account.move.payment.mode.cnab.change.form</field> | ||
<field name="model">account.move.payment.mode.cnab.change</field> | ||
<field name="arch" type="xml"> | ||
<form string="Set Payment Mode CNAB"> | ||
<group> | ||
<field name="payment_mode_id" /> | ||
</group> | ||
<footer> | ||
<button | ||
name="set_payment_mode" | ||
string="Confirm" | ||
class="btn-primary" | ||
type="object" | ||
/> | ||
<button string="Cancel" class="btn-default" special="cancel" /> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.actions.act_window" id="wizard_document_status_act_multi"> | ||
<field name="name">Set Payment Mode CNAB</field> | ||
<field name="res_model">account.move.payment.mode.cnab.change</field> | ||
<field name="view_mode">form</field> | ||
<field name="binding_model_id" ref="model_account_move" /> | ||
<field name="target">new</field> | ||
</record> | ||
|
||
</odoo> |