Skip to content

Commit

Permalink
Merge branch '10.0' into 10.0-correcoes_cnab_bradesco
Browse files Browse the repository at this point in the history
  • Loading branch information
danimaribeiro committed Mar 12, 2018
2 parents 1bf8baa + e151e83 commit f65016f
Show file tree
Hide file tree
Showing 15 changed files with 469 additions and 12 deletions.
1 change: 1 addition & 0 deletions br_account/__manifest__.py
Expand Up @@ -27,5 +27,6 @@
'views/product_fiscal_classification.xml',
'wizard/br_product_fiscal_classification_wizard.xml',
'security/ir.model.access.csv',
'views/account_invoice_refund.xml',
],
}
1 change: 1 addition & 0 deletions br_account/models/__init__.py
Expand Up @@ -14,3 +14,4 @@
from . import account_tax
from . import account_move
from . import res_partner
from . import account_invoice_refund
33 changes: 33 additions & 0 deletions br_account/models/account_invoice_refund.py
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# © 2018 Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models, fields, api


class AccountInvoiceRefund(models.TransientModel):
_inherit = 'account.invoice.refund'

fiscal_position_id = fields.Many2one(
'account.fiscal.position', string="Posição Fiscal")

@api.multi
def invoice_refund(self):
res = super(AccountInvoiceRefund, self).invoice_refund()

invoice_id = res['domain'][1][2][0]
invoice_id = self.env['account.invoice'].search([
('id', '=', invoice_id)
])

invoice_id.write({'fiscal_position_id': self.fiscal_position_id.id})

if self.fiscal_position_id:
for item in invoice_id.invoice_line_ids:
price_unit = item.price_unit
item._onchange_product_id()
item._br_account_onchange_product_id()
item.write({'price_unit': price_unit})
item._set_extimated_taxes(price_unit)

return res
13 changes: 13 additions & 0 deletions br_account/views/account_invoice_refund.xml
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="br_account_refund_view" model="ir.ui.view">
<field name="name">br_account.refund.view</field>
<field name="model">account.invoice.refund</field>
<field name="inherit_id" ref="account.view_account_invoice_refund"/>
<field name="arch" type="xml">
<field name="description" position="after">
<field name="fiscal_position_id" />
</field>
</field>
</record>
</odoo>
1 change: 1 addition & 0 deletions br_cnab/__init__.py
Expand Up @@ -5,3 +5,4 @@

from . import models
from . import tests
from . import wizard
1 change: 1 addition & 0 deletions br_cnab/__manifest__.py
Expand Up @@ -25,6 +25,7 @@
'data': [
'sequence/br_cnab_sequence.xml',
'views/payment_order.xml',
'wizard/wizard_import_cnab.xml',
],
'installable': True
}
2 changes: 1 addition & 1 deletion br_cnab/models/account_bank_statement_import.py
Expand Up @@ -131,7 +131,7 @@ def _parse_cnab(self, data_file, raise_error=False):
evento.numero_documento or "%s: %s" % (
move_line.move_id.name, move_line.name)),
'date': datetime.strptime(
str(evento.data_ocorrencia), '%d%m%Y'),
str(evento.data_ocorrencia).zfill(8), '%d%m%Y'),
'amount': valor,
'partner_name':
move_line.partner_id.name or evento.sacado_nome,
Expand Down
5 changes: 5 additions & 0 deletions br_cnab/wizard/__init__.py
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import wizard_import_cnab

0 comments on commit f65016f

Please sign in to comment.