Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

Automatically assign document_number in API

Martin Müller   ( User )

Commented 1 year ago

Hi, I'm trying to find a way where the document number is automatically assigned (last number+ 1) by akaunting when I submit a new document (invoice) via API. If the document_number is left empty, the response says it is mandatory. If set to 0 it will just use that as the document number. Is there a module or another way I can achieve this?

Martin Müller   ( User )

Commented 1 year ago

Did "a bit" of research into the topic and tried to build my own module. However, it seems there are too few events actually implemented because there is none before rules checking, so I can't modify document_number before the validator gives me the finger. Any ideas on how to proceed?

Martin Müller   ( User )

Commented 1 year ago

I wasn't able to do it before validation. However, we can circumvent it by just setting a negative document_number and checking for that in our event listener.

If anyone is interested in the solution: https://github.com/Vieweger-Software/auto-document-number

Please login or register to leave a response.

Showing 1 to 3 of 3 discussions