I have an application that creates orders in Dolibarr. It works but some fields seems to be set automatically (with wrong values) although the correct values are sent. I use the docs to create my calls. It's a product that is created in the example but I am using the same structure to create my orders. The totals are false: total_ht, total_tva, total_ttc. I am sure that the values I sent are correct and I checked the names of the fields both with insomnia and directly in the database (and in the swagger explorer provided).
I can set fields such as "ref" and "note_private" without any issue but some other fields don't take my values into account. I have the exact same issue with some order lines. I have two fields "tva_tx" and "vat_src_code" that are not always set as I want.
I checked and the values that are sent are very consistant so I should have the same result every time. Unless I am missing something...
This is what I send. I only show a few fields to avoid extra long code.
order = {
'ref': prestashop_item.get('reference'),
'note_private': note_private,
'type': 0,
'lines': order_lines,
'total_tva': float(tempTotalTaxes),
'total_ht': float(prestashop_item.get('total_paid_tax_excl', 0)),
'total_ttc': float(prestashop_item.get('total_paid_tax_incl', 0)),
}
And my call is ret_val = dolibarr_inst.call_create_api('orders', order)
, same as in the doc.