Skip to content

Commit

Permalink
[IMP] Improvements on boleto serialization (tests with Banco do Brasil)
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed Jun 25, 2015
1 parent 5c250cb commit 41ce6be
Show file tree
Hide file tree
Showing 16 changed files with 173 additions and 210 deletions.
87 changes: 0 additions & 87 deletions __unported__/l10n_br_account_payment_boleto/model/payment_mode.py

This file was deleted.

This file was deleted.

56 changes: 0 additions & 56 deletions __unported__/l10n_br_account_payment_boleto/view/payment_mode.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2014 KMEE (http://www.kmee.com.br)
# Account Payment Boleto module for Odoo
# Copyright (C) 2012-2015 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Miléo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
Expand All @@ -20,6 +20,6 @@
#
##############################################################################

from . import report
from . import reports
from . import boleto
from . import model
from . import models
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2014 KMEE (http://www.kmee.com.br)
# Account Payment Boleto module for Odoo
# Copyright (C) 2012-2015 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Miléo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
Expand All @@ -22,19 +22,21 @@


{
'name': 'Account Payment Boleto on Move Line',
'name': 'Odoo Brasil Account Payment Boleto',
'version': '0.1',
'category': 'Banking addons',
'license': 'AGPL-3',
'summary': 'Adds payment mode boleto on move lines',
'description': """ """,
'author': 'KMEE',
'website': 'http://www.kmee.com.br',
'depends': ['account_payment_move_line'],
'depends': [
'l10n_br_account_payment_mode'
],
'data': [
'view/payment_mode.xml',
'view/account_move_line.xml',
'report_print_button_view.xml',
'views/payment_mode.xml',
'views/account_move_line.xml',
'reports/report_print_button_view.xml',
],
'demo': [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2012 KMEE (http://www.kmee.com.br)
# Account Payment Boleto module for Odoo
# Copyright (C) 2012-2015 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Miléo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
# #############################################################################
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2012 KMEE (http://www.kmee.com.br)
# Account Payment Boleto module for Odoo
# Copyright (C) 2012-2015 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Miléo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -61,15 +61,20 @@ def __init__(self, move_line):
self.boleto = bank.get_class_for_codigo(bank_code)
self.create(move_line)


def create(self, move_line):
self.boleto.nosso_numero = move_line.ref.encode('utf-8')
self.boleto.numero_documento = move_line.name.encode('utf-8')
self.boleto.data_vencimento = datetime.date(datetime.strptime(move_line.date_maturity, '%Y-%m-%d'))
self.boleto.data_documento = datetime.date(datetime.strptime(move_line.invoice.date_invoice, '%Y-%m-%d'))
self.boleto.data_vencimento = datetime.date(datetime.strptime(
move_line.date_maturity, '%Y-%m-%d'))
self.boleto.data_documento = datetime.date(datetime.strptime(
move_line.invoice.date_invoice, '%Y-%m-%d'))
self.boleto.data_processamento = date.today()
self.boleto.valor_documento = move_line.debit

self.boleto.valor = str("%.2f" % move_line.debit or move_line.credit)
self.boleto.valor_documento = str("%.2f" % move_line.debit or
move_line.credit)
self.boleto.especie = \
move_line.currency_id and move_line.currency_id.symbol or 'R$'
self.boleto.quantidade = '' #str("%.2f" % move_line.amount_currency)
self.instrucoes(move_line.payment_mode_id)
self.payment_mode(move_line.payment_mode_id)
self.cedente(move_line.company_id)
Expand Down Expand Up @@ -114,7 +119,9 @@ def payment_mode(self, payment_mode_id):
:return:
"""
self.boleto.convenio = payment_mode_id.boleto_convenio.encode('utf-8')
self.boleto.especie_documento = payment_mode_id.boleto_modalidade.encode('utf-8')
self.boleto.especie_documento = \
payment_mode_id.boleto_modalidade.encode('utf-8')
self.boleto.aceite = payment_mode_id.boleto_aceite
self.boleto.carteira = payment_mode_id.boleto_carteira.encode('utf-8')
self.boleto.agencia_cedente = payment_mode_id.bank_id.bra_number.encode('utf-8')
self.boleto.conta_cedente = str(
Expand All @@ -141,13 +148,19 @@ def sacado(self, partner):
:param partner:
:return:
'''
self.boleto.sacado_endereco = partner.street + ', ' + partner.number
self.boleto.sacado_cidade = partner.city
self.boleto.sacado_bairro = partner.district
self.boleto.sacado_uf = partner.state_id.code
self.boleto.sacado_cep = partner.zip
self.boleto.sacado_nome = partner.legal_name
self.boleto.sacado_documento = partner.cnpj_cpf
self.boleto.sacado = \
[
"{0} - CNPJ/CPF: {1}".format(partner.legal_name, partner.cnpj_cpf),
"{0}, {1}".format(partner.street, partner.number),
# "{2}".format(fname, lname, age),
]
# self.boleto.sacado_endereco = partner.street + ', ' +
# self.boleto.sacado_cidade = partner.city
# self.boleto.sacado_bairro = partner.district
# self.boleto.sacado_uf = partner.state_id.code
# self.boleto.sacado_cep = partner.zip
# self.boleto.sacado_nome = partner.legal_name
# self.boleto.sacado_documento = partner.cnpj_cpf

@classmethod
def get_pdfs(cls, boletoList):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Account Payment Boleto module for Odoo
# Copyright (C) 2012-2015 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Miléo <mileo@kmee.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -21,4 +21,4 @@
##############################################################################

from . import payment_mode

from . import account_move_line
34 changes: 34 additions & 0 deletions l10n_br_account_payment_boleto/models/payment_mode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Boleto module for Odoo
# Copyright (C) 2012-2015 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Miléo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import models, fields, api

class PaymentMode(models.Model):
_inherit = 'payment.mode'

boleto_carteira = fields.Char('Carteira', size=2)
boleto_modalidade = fields.Char('Modalidade', size=2)
boleto_convenio = fields.Char(u'Codigo convênio', size=10)
boleto_variacao = fields.Char(u'Variação', size=2)
boleto_cnab_code = fields.Char('Codigo Cnab', size=20)
boleto_aceite = fields.Selection(
[('S', 'Sim'), ('N', 'Não')], string='Aceite', default='N')
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2012 KMEE (http://www.kmee.com.br)
# Account Payment Boleto module for Odoo
# Copyright (C) 2012-2015 KMEE (http://www.kmee.com.br)
# @author Luis Felipe Miléo <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
Expand Down
Loading

0 comments on commit 41ce6be

Please sign in to comment.