Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

ManualJournal POST request for updating existing manual journals creating unnecessary TaxAmount

Started by Luis Kang -   in API Endpoints

Hi Team.

I'm using Python 3.8 in my script.

I have a logic that when a certain Narrative & Date manual journal doesn't exist, then create a new one, if it exists, then update the existing one.

When creating a new one, everything is fine.

To create a new item, I'm sending a POST request to this endpoint.

https://api.xero.com/api.xro/2.0/ManualJournals/

with these line items.

array(
{
'Description': 'Deferred Income',
'LineAmount': monthly_sales,
'AccountCode': deferred_income_account_code,
'TaxType': tax_type
},
{
'Description': description,
'LineAmount': monthly_sales * -1,
'AccountCode': sales_account_code,
'TaxType': tax_type
}
)



And to update an existing item, I'm sending a POST request to this endpoint,
https://api.xero.com/api.xro/2.0/ManualJournals/manual_journal_id

with exactly the same line items.

When I create a new one, there is no "TaxAmount" field for each line and the total Tax is calculated well by multiplying LineAmount * TaxRate.

However, when I update an existing one, suddenly "TaxAmount" is set to 0.00 whilst containing the same LineAmount and TaxRate.

This is very ridiculous. I've done a lot of different attempts but nothing works.

Perhaps, a workaround is when I update an existing one, I should calculate the TaxAmount and add that value to prevent having TaxAmount 0.
But this is too cumbersome for me.

I think this is a Xero API bug. Can someone confirm this?

Thanks.