Hi,
I'm trying to create an invoice line using next code:
// Invoice line creation
$result = $models->execute_kw($db, $uid, $password,
'account.invoice.line', 'create',
array(array(
'Invoice'=>$invoice,
'invoice_id'=>$invoice_id,
'product_id'=>$product_id,
'quantity'=>$product_quantity,
'name'=>$product_name,
'price_unit'=>$product_price,
'invoice_line_tax_id'=>array($odoo_tax_id)
)));
The invoice line is created within invoice, but it hasn't any tax.
The existence of that tax is checked and I tried to relate the tax using others ways as:
'invoice_line_tax'=>array('id'=>$tax['id'],'name'=>$tax['name']),
But it doesn't work either.
The product and invoice used for the invoice line was created before using:
// Product creation
$product_id = $models->execute_kw($db, $uid, $password,
'product.product', 'create',
array(array(
'default_code'=>$product_ref,
'name'=>$product_name,
'list_price'=>$product_price,
))
);
// Invoice creation
$invoice_id = $models->execute_kw($db,$uid,$password,
'account.invoice',
'create',
array(array(
'partner_id'=>$parter_id,
'account_id'=>$odoo_invoice_account_id
)));
$invoice = $models->execute_kw($db,$uid,$password,
'account.invoice',
'read',
array($invoice_id),
array());
One person in other forum ask me if the product has the tax enabled, the product has the tax enabled for the clients and suppliers and I try to do an invoice directly in Odoo with the same product working fine.
I think that the main problem is how to create the relation between invoice line and the tax, because after creating invoice line appears next field:
["invoice_line_tax_id"]=> array(0) { }
But in an correct invoice line appears as:
["invoice_line_tax_id"]=> array(1) { [0]=> int(4) }
One person in other forum has suggested to install account.tax module, but that module depends on other module (base table) that generates an error during their installation and I don't want to depends on other modules if it's possible.
Thanks