Importing invoice data via CSV

Hi, I’ve been testing importing invoice data from CSV files. I’ve got it mostly working but have 2 questions that I’m wondering about.

  1. When an invoice is created upon import, the status is set to “Sent”. Is there a way to have that set to “Draft” instead?

  2. Is there a way to set additional fields in the CSV import. For example, the overall discount & tax rate for an invoice.

I’m running v4.5.11 self-hosted and am happy to modify the source code to make these changes – I just can’t seem to locate the correct sections.

Any direction would be greatly appreciated – extremely happy with InvoiceNinja overall!!

Thanks.

Hey superkeybee, Will you need to import invoices regularly or is this a one time event (in theory at least)? If one time event, have you tried to change the field in the database from “Sent” to “Draft”? phpmyadmin will make this easier if you are not a database person.

Yes it will be a regular process so I would prefer to have the status set upon import rather than updating the database. DB update would be easy enough, just another step in a process that we’re trying to streamline.

Do NOT manually update the database. We cache data for performance, it will cause the client balance to be incorrect.

1 and 2 aren’t supported with the CSV import but should be possible using an integrator such as Zapier or Integromat.

Thanks for the info Hillel. Item 1 is the most important to us at the momemt – is there a place in the InvoiceNinja code that sets the status of an imported invoice to “Sent” that we could easily flip to “Draft” in our self-hosted environment? The CSV import process has everything we need and I would hate to have to bring in a separate integrator service just for this one field. Thanks for any assistance that you can provide.

https://github.com/invoiceninja/invoiceninja/blob/master/app/Services/ImportService.php#L445

I haven’t tested commenting out this code, in may cause problems if the invoices are imported as paid.

Thanks Hillel, commenting that out does seem to allow us to import invoices and they show as “Draft”. We don’t expect to ever need to import invoices with a status other than Draft so this should work. Thanks!

Hi - I also have this requirement but am not certain the link above is still valid?

When I look at that, the line I see at 445 is:
$data[‘is_public’] = true;

That seems unrelated to status on the face of it - could someone please confirm?

Many thanks

Bill