Shared file global field
I've recently got into a problem with a shared file. I have a field that is used global.
The problem is that this file is shared and it seems that every user has its own global field, now I'm using this to know the next invoice number. This way the next invoice created will have this number, then the number gets +1. Invoice number is set when the user clicks save so it can't be a serial field instantiated on creation. Also some of the invoices might get deleted or redone so serial is not an option.
Now my fix, I used to set the invoice number as max(invoice number) +1 but it appears that even so there is still the possibility of having an invoice with the same number as people work in paralel on this an this is not acceptable.
Is there any way I can get one field global on all shared users, which can be set by script (save button). This way the workers will be able to do invoices in paralel? Or at least some workaround or ideea.