we are trying to set up a different sequence for document type by organization, but we saw that C_DocType has System/Client Access Level
so, we change that to client/organization but when we tried to save a record for an specific organization, the system set organization to zero (class MDocType, method before save)
the code looks like
if (getAD_Org_ID() != 0)
setAD_Org_ID(0);
so, can we set up a different sequence for each organization in compiere?
we tried to comment the code but we saw another problems like the methods to get the docucument sequence (MSequence.getDocumentNo) don´t receive the organization as a parameter, only the client
thanks in advance
regards
Logged In: YES
user_id=1705860
Originator: NO
You can do this indirectly via security.
Logged In: YES
user_id=1932288
Originator: YES
can you tell us more details, because we did that:
- change access level to client/organization
- comment before save in MDocType in order to set the selected organization
- change getDocumentNo method in MSequence in order to receive the AD_Org_ID parameter (and other classes)
The problem we found is that the getDocumentNo method do this condition ("WHERE Name = ?"), where Name = DocumentNo_TableName
we have for example
DocumentNo_C_Invoice sequence starts in 1
DocumentNo_C_InvoiceOrg1 sequence starts in 1000000
DocumentNo_C_InvoiceOrg2 sequence starts in 2000000
DocumentNo_C_InvoiceOrg3 sequence starts in 3000000
...
and when we execute the query, it doesn´t return the records we want, because the condition "WHERE Name = ?" is false, so if we put "Name LIKE DocumentNo_TableName%" the query returns to many records, for example for tables like M_Movement, MMovementConfirm, etc
So, we thought that compiere is not prepared to handle different sequence for different organization in document types
Can you explain us how do that indirectly via security ?
Thanks and regards
Logged In: YES
user_id=957380
Originator: NO
Really don't need to change anything in the code to get that:
simply duplicate your doctype by Org, and assign a new distinct sequence to each of the doctypes.
If you have then separate roles setup per Org, every user will see the doctype linked with appropriate org.
regards.