-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementando ação de envio de email com boletos
- Loading branch information
1 parent
94e5046
commit 99659d8
Showing
10 changed files
with
133 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2017 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountConfigSettings(models.TransientModel): | ||
_inherit = 'account.config.settings' | ||
|
||
boleto_email_tmpl = fields.Many2one( | ||
'mail.template', string="Template de Email para Envio de Boleto", | ||
domain=[('model_id.model', '=', 'account.invoice')]) | ||
|
||
def get_default_boleto_email_tmpl(self, fields): | ||
return {'boleto_email_tmpl': | ||
self.env.user.company_id.boleto_email_tmpl.id} | ||
|
||
@api.multi | ||
def set_default_boleto_email_tmpl(self): | ||
self.env.user.company_id.boleto_email_tmpl = self.boleto_email_tmpl |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2017 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = 'res.company' | ||
|
||
boleto_email_tmpl = fields.Many2one( | ||
'mail.template', string="Template de Email para Boleto") |
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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
<record id="account_config_settings_email_boleto" model="ir.ui.view"> | ||
<field name="name">account_config_settings.emai.boletol</field> | ||
<field name="model">account.config.settings</field> | ||
<field name="inherit_id" ref="account.view_account_config_settings"/> | ||
<field name="arch" type="xml"> | ||
<group name="followup" position="after" > | ||
<group string="Email Boleto" name="boleto_mail"> | ||
<field name="boleto_email_tmpl" /> | ||
</group> | ||
</group> | ||
</field> | ||
</record> | ||
</odoo> |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2017 Danimar Ribeiro, Trustcode | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class BoletoSendEmail(models.TransientModel): | ||
_name = 'boleto.send.email' | ||
|
||
@api.multi | ||
def send_boletos_by_email(self): | ||
context = dict(self._context or {}) | ||
active_ids = context.get('active_ids', []) or [] | ||
invoices = self.env['account.invoice'].browse(active_ids) | ||
invoices.send_email_boleto_queue() | ||
return {'type': 'ir.actions.act_window_close'} |
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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="view_br_boleto_send_email_wizard"> | ||
<field name="name">view_br_boleto.send.email.form</field> | ||
<field name="model">boleto.send.email</field> | ||
<field name="arch" type="xml"> | ||
<form string="Enviar emails"> | ||
<footer> | ||
<button name="send_boletos_by_email" type="object" string="Enviar e-mails" class="oe_highlight"/> | ||
or | ||
<button special="cancel" string="Cancelar"/> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
|
||
<act_window id="br_boleto_action" | ||
name="Enviar boletos via e-mail" | ||
src_model="account.invoice" | ||
res_model="boleto.send.email" | ||
view_mode="form" | ||
target="new" | ||
key2="client_action_multi"/> | ||
|
||
</odoo> |