Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
9926 Переглядів


I have a non-iterable type error when I want to go through the detail of an invoice. the idea is to read one line of the invoice, all the taxes that line has, you can one or more.
I read that you can not go int or float, but I can not find how to do it.
Thank you,

for line in self.invoice_line_ids:
      for line_tax in line.invoice_line_tax_ids:
             if line_tax.tipo_afectacion_isc.code in ["01","02","03"]:
                  self.total_isc = sum(line.price_subtotal*line.invoice_line_tax_ids.amount/100) if len(line.invoice_line_tax_ids)>0 else False

Аватар
Відмінити
Найкраща відповідь

Inside the sum() function, you must have some type of iteration.

Try following code:

​self.total_isc = sum(line.price_subtotal * tax.amount / 100 for tax in line.invoice_line_tax_ids)


Аватар
Відмінити
Автор

I do not see an error, but I do not consider this line.( if line_tax.tipo_afectacion_isc.code in ["01","02","03"]: )

for line in self.invoice_line_ids:

for line_tax in line.invoice_line_tax_ids:

if line_tax.tipo_afectacion_isc.code in ["01","02","03"]:

self.total_isc = sum(line.price_subtotal*line.invoice_line_tax_ids.amount/100) if len(line.invoice_line_tax_ids)>0 else False

Do you mean the execution is not going in the if condition? If yes, print the code.

print line_tax.tipo_afectacion_isc.code, line_tax.tipo_afectacion_isc.code in ["01","02","03"]

Автор

Thank you,

solved with the information you gave me.

Related Posts Відповіді Переглядів Дія
2
серп. 25
2163
1
лип. 25
706
1
серп. 25
1150
0
трав. 25
1245
2
квіт. 25
3405