Skip to content

Commit

Permalink
[IMP] black, isort
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed Dec 19, 2019
1 parent 66d50b8 commit f636a9f
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 118 deletions.
41 changes: 20 additions & 21 deletions l10n_br_account_payment_order/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Brazilian Payment Order',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'author': "KMEE, "
"Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/l10n-brazil',
'category': 'Banking addons',
'depends': [
'l10n_br_base',
'account_payment_order',
'account_due_list',
'account_cancel',
"name": "Brazilian Payment Order",
"version": "12.0.1.0.0",
"license": "AGPL-3",
"author": "KMEE, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-brazil",
"category": "Banking addons",
"depends": [
"l10n_br_base",
"account_payment_order",
"account_due_list",
"account_cancel",
],
'data': [
'views/account_payment_order_menu_views.xml',
'views/account_due_list.xml',
'views/account_payment_line.xml',
'views/account_payment_mode.xml',
"data": [
"views/account_payment_order_menu_views.xml",
"views/account_due_list.xml",
"views/account_payment_line.xml",
"views/account_payment_mode.xml",
],
'demo': [
'demo/account_payment_order_demo.xml',
'demo/account_payment_mode_demo.xml'
"demo": [
"demo/account_payment_order_demo.xml",
"demo/account_payment_mode_demo.xml",
],
'installable': True,
"installable": True,
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
<field name="account_id" ref="1_account_template_3010101010200_avoid_travis_error_2"/>
</record>

</odoo>
</odoo>
14 changes: 7 additions & 7 deletions l10n_br_account_payment_order/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Luis Felipe Miléo - [email protected]
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields, api
from odoo import api, fields, models


class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
_inherit = "account.move.line"

date_scheduled = fields.Date(string='Data Prevista')
date_scheduled = fields.Date(string="Data Prevista")

@api.depends('move_id')
@api.depends("move_id")
def _compute_journal_entry_ref(self):
for record in self:
if record.name:
Expand All @@ -20,11 +20,11 @@ def _compute_journal_entry_ref(self):
elif record.invoice_id and record.invoice_id.number:
record.journal_entry_ref = record.invoice_id.number
else:
record.journal_entry_ref = '*' + str(record.move_id.id)
record.journal_entry_ref = "*" + str(record.move_id.id)

journal_entry_ref = fields.Char(
compute='_compute_journal_entry_ref',
string='Journal Entry Ref', store=True)
compute="_compute_journal_entry_ref", string="Journal Entry Ref", store=True
)

@api.multi
def get_balance(self):
Expand Down
63 changes: 39 additions & 24 deletions l10n_br_account_payment_order/models/account_payment_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,59 @@
# Luis Felipe Miléo - [email protected]
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields, api
from odoo import api, fields, models
from odoo.addons import decimal_precision as dp
from odoo.tools.float_utils import float_round as round


class PaymentLine(models.Model):
_inherit = 'account.payment.line'
_inherit = "account.payment.line"

@api.model
def _get_info_partner(self, partner_record):
if not partner_record:
return False
st = partner_record.street or ''
n = partner_record.street_number or ''
st1 = partner_record.street2 or ''
zip = partner_record.zip or ''
city = partner_record.city_id.name or ''
uf = partner_record.state_id.code or ''
zip_city = city + '-' + uf + '\n' + zip
cntry = partner_record.country_id and \
partner_record.country_id.name or ''
cnpj = partner_record.cnpj_cpf or ''
return partner_record.legal_name or '' + "\n" + cnpj + "\n" + st \
+ ", " + n + " " + st1 + "\n" + zip_city + "\n" + cntry
st = partner_record.street or ""
n = partner_record.street_number or ""
st1 = partner_record.street2 or ""
zip = partner_record.zip or ""
city = partner_record.city_id.name or ""
uf = partner_record.state_id.code or ""
zip_city = city + "-" + uf + "\n" + zip
cntry = partner_record.country_id and partner_record.country_id.name or ""
cnpj = partner_record.cnpj_cpf or ""
return (
partner_record.legal_name
or ""
+ "\n"
+ cnpj
+ "\n"
+ st
+ ", "
+ n
+ " "
+ st1
+ "\n"
+ zip_city
+ "\n"
+ cntry
)

@api.multi
@api.depends('percent_interest', 'amount_currency')
@api.depends("percent_interest", "amount_currency")
def _compute_interest(self):
for record in self:
precision = record.env[
'decimal.precision'].precision_get('Account')
precision = record.env["decimal.precision"].precision_get("Account")
record.amount_interest = round(
record.amount_currency * (
record.percent_interest / 100), precision)
record.amount_currency * (record.percent_interest / 100), precision
)

linha_digitavel = fields.Char(string="Linha Digitável")
percent_interest = fields.Float(string="Percentual de Juros",
digits=dp.get_precision('Account'))
amount_interest = fields.Float(string="Valor Juros",
compute='_compute_interest',
digits=dp.get_precision('Account'))
percent_interest = fields.Float(
string="Percentual de Juros", digits=dp.get_precision("Account")
)
amount_interest = fields.Float(
string="Valor Juros",
compute="_compute_interest",
digits=dp.get_precision("Account"),
)
19 changes: 10 additions & 9 deletions l10n_br_account_payment_order/models/account_payment_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
# @author Luis Felipe Miléo - [email protected]
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields
from odoo import fields, models


class AccountPaymentMode(models.Model):
_inherit = 'account.payment.mode'
_inherit = "account.payment.mode"

internal_sequence_id = fields.Many2one('ir.sequence', 'Sequência')
instrucoes = fields.Text('Instruções de cobrança')
invoice_print = fields.Boolean(
'Gerar relatorio na conclusão da fatura?')
internal_sequence_id = fields.Many2one("ir.sequence", "Sequência")
instrucoes = fields.Text("Instruções de cobrança")
invoice_print = fields.Boolean("Gerar relatorio na conclusão da fatura?")

_sql_constraints = [
('internal_sequence_id_unique',
'unique(internal_sequence_id)',
'Sequência já usada! Crie uma sequência unica para cada modo')
(
"internal_sequence_id_unique",
"unique(internal_sequence_id)",
"Sequência já usada! Crie uma sequência unica para cada modo",
)
]
18 changes: 10 additions & 8 deletions l10n_br_account_payment_order/models/res_partner_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
# Magno Costa <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import models, api, _
from odoo import _, api, models
from odoo.exceptions import Warning as UserError


class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
_inherit = "res.partner.bank"

@api.multi
@api.constrains('bra_number')
@api.constrains("bra_number")
def check_bra_number(self):
for record in self:
if record.bank_id.code_bc == '033':
if record.bank_id.code_bc == "033":
if len(record.bra_number) > 4:
raise UserError(_(
u'O cógido da Agencia Bancaria do Santander'
u' deve ter no máximo quatro caracteres.'
))
raise UserError(
_(
u"O cógido da Agencia Bancaria do Santander"
u" deve ter no máximo quatro caracteres."
)
)
2 changes: 1 addition & 1 deletion l10n_br_account_payment_order/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
No configuration required.
No configuration required.
1 change: 0 additions & 1 deletion l10n_br_account_payment_order/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
* Fernando Marcato <[email protected]>
* Hendrix Costa <[email protected]>
* Magno Costa <[email protected]>

2 changes: 1 addition & 1 deletion l10n_br_account_payment_order/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The development of this module has been financially supported by:

* KMEE INFORMATICA LTDA - www.kmee.com.br
* AKRETION LTDA - www.akretion.com
* AKRETION LTDA - www.akretion.com
2 changes: 1 addition & 1 deletion l10n_br_account_payment_order/readme/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
12.0.1.0.0 (2019-06-06)
~~~~~~~~~~~~~~~~~~~~~~~

* [MIG] Migração para a versão 12.0.
* [MIG] Migração para a versão 12.0.
Loading

0 comments on commit f636a9f

Please sign in to comment.