Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0020274Openbravo ERP09. Financial managementpublic2012-04-16 13:382012-04-21 14:24
dmiguelez 
dmiguelez 
normaltrivialalways
closedfixed 
20Community Appliance
pi 
 
Core
No
0020274: Code Review: When looking for credit of a Business Partner it does not take all the possible Payment Status into account.
Code Review:

In AdvPaymentMngtDao.java
When searching for the credit of a Business Partner it does not take all the possibles status of the Payments into account.
public List<FIN_Payment> getCustomerPaymentsWithCredit(Organization org, BusinessPartner bp,
      boolean isReceipt) {

    List<String> paidStatus = FIN_Utility.getListPaymentConfirmed();
    try {
      OBContext.setAdminMode(true);
      OBCriteria<FIN_Payment> obcPayment = OBDal.getInstance().createCriteria(FIN_Payment.class);
      obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_BUSINESSPARTNER, bp));
      obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_RECEIPT, isReceipt));
      obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_GENERATEDCREDIT, BigDecimal.ZERO));
      obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_STATUS, "RPAP"));
      obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_STATUS, "RPVOID"));
      obcPayment.add(Restrictions.neProperty(FIN_Payment.PROPERTY_GENERATEDCREDIT,
          FIN_Payment.PROPERTY_USEDCREDIT));
      final Organization legalEntity = FIN_Utility.getLegalEntityOrg(org);
      Set<String> orgIds = OBContext.getOBContext().getOrganizationStructureProvider()
          .getChildTree(legalEntity.getId(), true);
      obcPayment.add(Restrictions.in("organization.id", orgIds));
      obcPayment.addOrderBy(FIN_Payment.PROPERTY_PAYMENTDATE, true);
      obcPayment.addOrderBy(FIN_Payment.PROPERTY_DOCUMENTNO, true);
      return obcPayment.list();
    } finally {
      OBContext.restorePreviousMode();
    }
  }


When filtering by status it does not take into account the possible status modules can introduce in the system.
No tags attached.
depends on feature request 0020273 closed dmiguelez It would be usefull to have a method that returns a list of payment confirmed/not confirme status 
Issue History
2012-04-16 13:38dmiguelezNew Issue
2012-04-16 13:38dmiguelezAssigned To => vmromanos
2012-04-16 13:38dmiguelezModules => Core
2012-04-16 13:42dmiguelezAssigned Tovmromanos => dmiguelez
2012-04-16 13:42dmiguelezStatusnew => scheduled
2012-04-16 13:42dmiguelezfix_in_branch => pi
2012-04-16 15:43dmiguelezRelationship addeddepends on 0020273
2012-04-19 09:59hgbotCheckin
2012-04-19 09:59hgbotNote Added: 0047729
2012-04-19 09:59hgbotStatusscheduled => resolved
2012-04-19 09:59hgbotResolutionopen => fixed
2012-04-19 09:59hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/39b4cef629e4ea200e17465dd992e878177490b6 [^]
2012-04-19 12:12miruritaNote Added: 0047742
2012-04-19 12:12miruritaStatusresolved => closed
2012-04-21 14:24hudsonbotCheckin
2012-04-21 14:24hudsonbotNote Added: 0047837

Notes
(0047729)
hgbot   
2012-04-19 09:59   
Repository: erp/devel/pi
Changeset: 39b4cef629e4ea200e17465dd992e878177490b6
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Mon Apr 16 16:26:50 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/39b4cef629e4ea200e17465dd992e878177490b6 [^]

Fixes issue 0020274: Now a list of all possible Payment Status
is retrieved instead.

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java
---
(0047742)
mirurita   
2012-04-19 12:12   
code review + testing OK
(0047837)
hudsonbot   
2012-04-21 14:24   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/2eb57286c1fc [^]

Maturity status: Test