Updating invoice_item on multiple project invoice

Hey there,

It seems that the API does not support updating an invoice_item income category when the invoice is for multiple project.

I get the following error when trying to update it: status: 422, errors: {"errors"=>[{"message"=>"project_id is locked and cannot be changed"}]}

Hi there @robink,

Thanks for contacting us!

You are right: FreeAgent (and the API) should support changing the category of an invoice, even one that is associated with multiple projects. However, there are circumstances where you will be unable to do this. The error message that you’re seeing is from one these circumstances; FreeAgent provides “locks” on attributes to prevent unintentional accounting effects.

Some invoice and invoice item attributes will automatically lock after you email an invoice, mark it as sent or write it off. This is to prevent unintentional accounting problems.

Are you able to check the invoices for the invoice items you are trying to change and see if either the invoices are sent or written off?

Let me know if not, and we can see if there is something else happening here.

Best regards,
James

Those invoices are sent and paid.
I’m trying to update the income category of invoice_items.

But the fact is it works when I’m using Freeagent directly. Not through the API…

Just found a clue of what the bug might be :

  • Through API, loop over all invoice_items of a multiple projects invoice.
  • Make a PUT on each invoice_item, like the following: PUT /invoice_items/#id with invoice_item: { category: "http://..." }
  • All PUT requests are going to work for invoice_items of the first project, then it will raise an error for all others.

Well it seems that it is not true for every invoices. Some just fails directly.

Hmm, that is interesting. If you’d like, you can message me directly by clicking on my avatar, and then on “Message”) to send me the name of the your API application and we can dig in further.

For the invoices that you find are failing directly on the API, are you able to update those via the web interface?

Hey @James_Bell I can’t find a way to message you directly … :frowning:

Anyway: it’s a new month so it’s a new period for me to dig on this.

send me the name of the your API application and we can dig in further.

What do you mean by API application name ? Do you mean the client id ? If so : “8K2LqSUHuFx1wHWoeQoaNQ”

For the invoices that you find are failing directly on the API, are you able to update those via the web interface?

Yup