In case anyone has encounter this problem, I have a requirement where I need an installation with 4 companies (A,B,C,D). Those companies use the same naming series for government fiscal control, but they have different counters.
Let’s say company “A” has generated NR00025 series but company “B” needs NR00008. Is there a way to accomplish this or is it recommended to have all companies on separate tenants?
If you are having custom application then you can use autoname doc_events in hooks to execute method for custom naming series according to your requirement.
first of all is it recommended to have all companies on separate tenants? → you can manage multi-company in single-tenant that is why the multi-company structure has been provided in ERPNext.
Naming Series → by below method you create your own naming series
Thank you @khushal_t given the type of naming series we need is why I am asking the “tenant thing”.
Maybe is more the logic I should find than the ERPNext capability. Since it will be same name but different counters, because in DB I can’t have same name with different counter, I will probable need to prefix the abbr of the company and then clear that part when I am going to show it on invoices.
Given that solution where can I set it? your code seems like python, I am not making custom APP maybe custom changes through custom script, is that possible? I don’t want to mess with code unless mandatory.
When i use the .abbr. function at start it gives an error … it in only works for 1 doc series. If i want to use it for another doc series it doesnt work. e.g. abbr.-sales-#### would work but when i add abbr.-purchase-#### it gives error that the series already exists in sales.
I want all naming series to start with the company abbreviation. e.g. sales invoice, purchase invoice, sales order, etc. each to start with company abbreviation:
Sales Invoices : .abbr.-SINV-####
Sales Order : .abbr.-SO-####
Purchase Invoices : .abbr.-PINV-####
Purchase Quotation : .abbr.-PQ-####
I had already created the custom fields. The issue is that when I use abr in naming series of one doc it works fine but when i add it to a second doc, it gives error that already used.
e.g. {{abr}}.-PINV-.YYYY works fine but as soon as I add {{abr}}.-SINV-.YYYY, it is not allowed by system showing an error that this already exists for Purchase Invoice. Now this is technically incorrect as {{abr}}.-SINV is not used in any other doc. But somehow using the .abr. field second time as a first prefix in naming series results in error.