Ir al contenido
Menú
Se marcó esta pregunta

Hi all,

I'm trying to create an automatic action that is triggered by Customer Invoice creation. The invoice would have 3 invoice lines, one for a customer payment, one for a payment provider fee and one for commission. I would like to create 3 separate Supplier Invoices. Everything is fine until I get to invoice.line object. I need to somehow to differentiate between the three records using the product_id when I'm creating the individual Supplier Invoices. Conceptually, this is what I would like to do:

for line in object.invoice_line:         if line.product_id = 2:        [(0, 0, {'name': line.name, 'product_id': line.product_id.id, 'account_id': line.account_id.id, 'account_analytic_id': line.account_analytic_id.id, 'quantity': line.quantity, 'price_unit': line.price_unit})]

   

The above doesn't work. I'd imagine the invoice_line is not an array? My python-fu is pretty weak though. The third line works fine on it's own but only if there's only one invoice line. This would work as well but having all the amounts as invoice lines is tidier.

Any idea how I could add some conditions when creating an invoice line on the Automated Actions interface so that I could pull values of one of them based on the invoice.line.product_id.

Thanks.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
feb 25
3596
0
may 24
46
1
abr 24
3378
4
sept 23
4881
2
sept 23
7106