Or is there an other better or easier solution for creating invoices from a list of custom docs?
I linked a Invoice Template to the custom doctype from which I would like to fetch the items and an address is linked to the “Camp Participant” which I’d use for the Invoice billing address.
Thanks Peter!
Your right I mixed them up.
BUT, its still not working. The erpnext.bulk_transaction_processing.create throws an Uncaught TypeError: erpnext.bulk_transaction_processing.create is not a function
and the frappe.call({method: "erpnext.utilities.bulk_transaction.transaction_processing",[...] ends up in an frappe.exceptions.ValidationError: Failed to get method for command erpnext.utilities.bulk_transaction.transaction_processing with No module named 'erpnext.utilities.bulk_transaction'
Do I have to import any module? Aren’t these methods globaly available?
If you’re using v13, I’m not sure what if anything exists. What kind of document are you trying to generate the invoices from? In most cases, you could probably do what you’re trying to do with a server script.
Aaaaah okay! I see. Thanks a lot. I will test this in v14.
I try to generate them from a custom DocType which is linked to a Invoice Template.
Is there a documentation for getting this done as server script?
The term is something I came up with. I thought of having a entity like “sales order” (which can be fetched in the invoice) which holds the items, taxes etc. for the invoice.
We need to create a huge amount of similar invoices (same items, taxes, payment terms, terms and conditions, accounting details etc.) for a lot of people which have all booked our camp.
I would like to fetch the customer and this invoice template and generate a few houndred invoices (as draft) from that.
Does that sound reasonable?
I see, bulk transaction processing needs existing docs which I haven’t.
So probably “frappe.new_doc” is the function to go with? And is there a way to create them in bulk without open every invoice on creating?
Sure, that’s not a problem. The frappe.new_doc method doesn’t require you to open the invoices manually. If you have a list of customers, you can burn through them very quickly to generate as many invoices as you’d like.
The specifics will depend on how your customer data is aggregated and stored.
I believe frappe.db.insert() is just a shorthand for frappe.db.new_doc({...}).insert(), though I’d have to check to be sure. In any case, they appear to do the same thing.
You could certainly do this all on the server side too. If you have a custom doctype that defines customers and charges, you could write a server script that generates individual invoices. If you’re doing hundreds of invoices at once, server-side is definitely the better option.