Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
8738 Lượt xem

I am using the following PHP code to create a new invoice via webservice API

$id = $models->execute_kw($db, $uid, $password,'res.partner', 'create',array($datos_cliente));
$invoice_id = $models->execute_kw($db,$uid,$password,'account.invoice','create', array(array( 'partner_id'=>$id, account_id'=>193 )));

$result = $models->execute_kw($db, $uid, $password,'account.invoice.line', 'create', array(array( 'account_id'=>477, 'invoice_id'=>$invoice_id, 'quantity'=>1, 'name'=>'Venta de prueba', 'invoice_line_tax_ids' => array(array(4, 23,false)), 'price_unit'=>200.00 )));

The invoice is created and the line shows correct tax code but tax amount is not calculated (Other info tab is blank), but if the line is edited (say  quatity or price is modified) tax is calculated correctly.

What I am doing wrong or missed at invoice creation

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

why compute_taxes is not working with Odoo12? Although it returns 'true' as an RPC response, it doesn't associate taxes to an invoice in 'draft' state

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

For those who might stumble upon this. In odoo 10 I had success using:

$models->execute_kw($db, $uid, $password, 'account.invoice', 'compute_taxes', array($id_of_invoice));

because compute_taxes expects a sequence.
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

account.invoice has a method called compute_taxes which you can call with the id of the invoice you want to update the taxes on as parameter.

Since I'm working with Python/Odoo, and it's been a while since I last used PHP,  I can only guess:

$models->execute_kw($db, $uid, $password, 'account.invoice', 'compute_taxes', $id_of_invoice); 
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 15
9302
0
thg 3 24
1530
3
thg 8 25
1754
0
thg 12 23
1657
0
thg 7 23
649