43
43
for invoice_tax in self.browse(cr, uid, ids, context=context):
44
44
res[invoice_tax.id] = {}
45
if 'tax_id' in self._columns:
46
res[invoice_tax.id]['name2'] = (invoice_tax.tax_id.tax_category_id and invoice_tax.tax_id.tax_category_id.name or invoice_tax.tax_id.name).upper()
47
res[invoice_tax.id]['tax_percent'] = invoice_tax.amount and invoice_tax.base and invoice_tax.amount*100.0 / abs( invoice_tax.base ) or 0.0
49
tax_name = invoice_tax.name.lower().replace('.','').replace(' ', '').replace('-', '')
50
tax_percent = invoice_tax.amount and invoice_tax.base and invoice_tax.amount*100.0 / abs( invoice_tax.base ) or 0.0
54
tax_percent = round(tax_percent, 0)#Hay problemas de decimales al calcular el iva, y hasta ahora el iva no tiene decimales
55
elif 'isr' in tax_name:
57
elif 'ieps' in tax_name:
59
res[invoice_tax.id]['name2'] = tax_name
60
res[invoice_tax.id]['tax_percent'] = tax_percent
61
#res[invoice_tax.id]['amount'] = invoice_tax.amount
45
tax = 'tax_id' in self._columns and invoice_tax.tax_id or False#If patch apply and module account_invoice_tax install
46
tax_name = (tax and tax.tax_category_id and tax.tax_category_id.code or invoice_tax.name).upper().replace('.','').replace(' ', '').replace('-', '')
47
tax_percent = (tax and tax.amount*100.0 or False)#validate? type='percent'
48
tax_percent = tax_percent or ( invoice_tax.amount and invoice_tax.base and invoice_tax.amount*100.0 / abs( invoice_tax.base ) or 0.0 )
51
if not tax and tax_percent > 0:
52
tax_percent = round(tax_percent, 0)#Hay problemas de decimales al calcular el iva, y hasta ahora el iva no tiene decimales
53
elif 'ISR' in tax_name:
55
elif 'IEPS' in tax_name:
57
res[invoice_tax.id]['name2'] = tax_name
58
res[invoice_tax.id]['tax_percent'] = tax_percent
59
#res[invoice_tax.id]['amount'] = invoice_tax.amount