Skip to Content
Menu
This question has been flagged
1863 Views

Hello,


I am unable to add tax to my invoice.

I can correctly create the invoice and its lines.

I have tried various solutions but without success, the tax_line_ids field remains empty no matter what I do.


I tried the following solutions that I found on the forum :


$content = array(
  'Invoice'=> $invoiceCreated[0],
  'invoice_id'=> $result["invoice"],
  'product_id'=> 3,
  'quantity'=> $v->getQuantity(),
  'name'=> $v->getComment(),
  'account_id' => xxxx,
  'price_unit'=> $v->getAmount(),
  'discount' => $v->getDiscount(),
  'invoice_line_tax_ids' => array(1),//dont' do anything 
); 
$result["invoiceLines"][] = $this->client->create( 'account.invoice.line', $content );

and

Create the invoice then add the tax after


$invoiceCreated = $this->client->read('account.invoice.line', array($v));
$taxAdd = $this->client->write( 'account.invoice.line', $v, 
  ["tax_line_ids" => array(1)]

None of them work.


There are no errors, but no taxes. I specify that the article does have a tax which is added automatically if I create an invoice via the interface.


Can you help me ?

Thank you


---------Update---------


I succeeded for each line to display the desired tax by updating the line like this

'invoice_line_tax_ids' => array (array (4, 1, true)),


But the tax is not calculated and remains at 0 €

Avatar
Discard