Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3475 Visualizzazioni

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ago 25
2539
3
feb 25
3832
0
mag 24
46
1
apr 24
3532
4
set 23
5072