Skip to content

Commit

Permalink
[IMP] Change account.invoice copy to br_nfe
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaGD committed Jun 12, 2019
1 parent 8b13dda commit a6d4902
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions br_account_tax_python/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class AccountInvoiceLine(models.Model):

def _prepare_tax_context(self):
res = super(AccountInvoiceLine, self)._prepare_tax_context()
lines = self.invoice_id.invoice_line_ids
amount_total = sum(l.valor_bruto + l.price_tax - l.valor_desconto for l in lines)
amount = (self.invoice_id.amount_total
+ self.quantity * self.price_unit)
res['invoice_amount'] = amount
Expand Down
10 changes: 10 additions & 0 deletions br_nfe/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ def _prepare_edoc_item_vals(self, invoice_line):
vals['informacao_adicional'] = invoice_line.informacao_adicional
return vals

@api.multi
def copy(self, default=None):
self.ensure_one()
new_acc_inv = super(AccountInvoice, self).copy(default)
if self.import_declaration_ids:
new_acc_inv.import_declaration_ids = self.import_declaration_ids
for i in range(len(new_acc_inv.invoice_line_ids)):
new_acc_inv.invoice_line_ids[i].declaration_line_ids = \
self.invoice_line_ids[i].declaration_line_ids
return new_acc_inv

class AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'
Expand Down

0 comments on commit a6d4902

Please sign in to comment.