Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

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
Buang
Post Terkait Replies Tampilan Aktivitas
3
Feb 25
3507
0
Mei 24
46
1
Apr 24
3335
4
Sep 23
4821
2
Sep 23
7033