Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0041639Openbravo ERP09. Financial managementpublic2019-08-13 10:232019-08-13 10:31
guillermogil 
Triage Omni OMS 
highmajorsometimes
closedduplicate 
5
 
 
Advanced Payables and Receivables Mngmt
No
0041639: getDocumentType query is not taking into account docTypes set a isReturn
Query is ordering by id and not tenking into account the return.
This may have some problem while generating the shipment on the POS in the case the return one as an id higher than the not return one.

We've been able to reproduce with the functionality Issue Sales Order

  public static DocumentType getDocumentType(Organization org, String docCategory) {
    Client client = null;
    if ("0".equals(org.getId())) {
      client = OBContext.getOBContext().getCurrentClient();
      if ("0".equals(client.getId())) {
        return null;
      }
    } else {
      client = org.getClient();
    }

    OBContext.setAdminMode(false);
    try {
      StringBuilder where = new StringBuilder();
      where.append(" as dt");
      where.append(" where dt.organization.id in (:orgIdList)");
      where.append(" and dt.client.id = :clientId");
      where.append(" and dt.documentCategory = :docCategory");
      where.append(" order by ad_isorgincluded(:orgId, dt.organization.id, :clientId)");
      where.append(" , dt.default desc");
      where.append(" , dt.id desc");

      OBQuery<DocumentType> dt = OBDal.getInstance()
          .createQuery(DocumentType.class, where.toString());
      dt.setFilterOnReadableClients(false);
      dt.setFilterOnReadableOrganization(false);
      dt.setMaxResult(1);
      dt.setNamedParameter("orgIdList",
          new OrganizationStructureProvider().getParentTree(org.getId(), true));
      dt.setNamedParameter("clientId", client.getId());
      dt.setNamedParameter("docCategory", docCategory);
      dt.setNamedParameter("orgId", org.getId());

      return dt.uniqueResult();
    } finally {
      OBContext.restorePreviousMode();
    }
  }
N/A
Add the filter for isReturn on the query
No tags attached.
has duplicate design defect 0041056 acknowledged Triage Omni WMS Modules m_inout can have a return document type coming from a sales order 
Issue History
2019-08-13 10:23guillermogilNew Issue
2019-08-13 10:23guillermogilAssigned To => Triage Finance
2019-08-13 10:23guillermogilModules => Advanced Payables and Receivables Mngmt
2019-08-13 10:23guillermogilTriggers an Emergency Pack => No
2019-08-13 10:30SandrahuguetRelationship addedhas duplicate 0041056
2019-08-13 10:31SandrahuguetNote Added: 0113962
2019-08-13 10:31SandrahuguetStatusnew => closed
2019-08-13 10:31SandrahuguetResolutionopen => duplicate

Notes
(0113962)
Sandrahuguet   
2019-08-13 10:31   
duplicate of 41056