Skip to content

Commit

Permalink
Merge branch '10.0' into 10.0-fix-numeracao-nota-compra
Browse files Browse the repository at this point in the history
  • Loading branch information
danimaribeiro committed Dec 30, 2016
2 parents ebcced1 + 795965b commit 1db496b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions br_account/models/account_fiscal_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ class AccountFiscalPosition(models.Model):
'account.fiscal.position.tax.rule', 'fiscal_position_id',
string="Regras II", domain=[('domain', '=', 'ii')])

def _filter_rules(self, fpos_id, type_tax, partner,
product, state):
def _filter_rules(self, fpos_id, type_tax, partner, product, state):
rule_obj = self.env['account.fiscal.position.tax.rule']
domain = [('fiscal_position_id', '=', fpos_id),
('domain', '=', type_tax)]
Expand All @@ -121,8 +120,9 @@ def _filter_rules(self, fpos_id, type_tax, partner,
rules_points[rule.id] -= 1
if len(rule.state_ids) > 0:
rules_points[rule.id] -= 1

greater_rule = max([(v, k) for k, v in rules_points.items()])
if greater_rule[0] <= 0:
return {}
rules = [rules.browse(greater_rule[1])]

return {
Expand Down
4 changes: 2 additions & 2 deletions br_nfe/models/invoice_eletronic.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,9 @@ def action_send_eletronic_invoice(self):

@api.multi
def action_cancel_document(self, context=None, justificativa=None):
super(InvoiceEletronic, self).action_cancel_document()
if self.model not in ('55', '65'):
return
return super(InvoiceEletronic, self).action_cancel_document(
justificativa=justificativa)

if not justificativa:
return {
Expand Down
3 changes: 3 additions & 0 deletions br_nfe/wizard/cancel_nfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models
from odoo.exceptions import UserError


class CancelNFe(models.TransientModel):
Expand All @@ -16,3 +17,5 @@ def action_cancel_nfe(self):
if self.edoc_id and len(self.justificativa) > 15:
self.edoc_id.action_cancel_document(
justificativa=self.justificativa)
else:
raise UserError(u"Justificativa deve ter mais de 15 caracteres")
2 changes: 1 addition & 1 deletion br_nfe/wizard/carta_correcao_eletronica.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="view_wizard_cancel_nfe">
<record model="ir.ui.view" id="view_wizard_carta_correcao_nfe">
<field name="name">wizard.carta.correcao.eletronica</field>
<field name="model">wizard.carta.correcao.eletronica</field>
<field name="arch" type="xml">
Expand Down
4 changes: 2 additions & 2 deletions br_nfse/models/invoice_eletronic.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def action_send_eletronic_invoice(self):

@api.multi
def action_cancel_document(self, context=None, justificativa=None):
super(InvoiceEletronic, self).action_cancel_document()
if self.model not in ('001'):
return
return super(InvoiceEletronic, self).action_cancel_document(
justificativa=justificativa)

cert = self.company_id.with_context({'bin_size': False}).nfe_a1_file
cert_pfx = base64.decodestring(cert)
Expand Down

0 comments on commit 1db496b

Please sign in to comment.