Jacopo Cappellato created OFBIZ-5622:
----------------------------------------

             Summary: Incorrect creation logic for ShipmentItemBilling records
                 Key: OFBIZ-5622
                 URL: https://issues.apache.org/jira/browse/OFBIZ-5622
             Project: OFBiz
          Issue Type: Bug
          Components: accounting
    Affects Versions: SVN trunk
            Reporter: Jacopo Cappellato
            Priority: Minor


When invoice is created the following code is run for each invoice item:
{code}
if ("ItemIssuance".equals(currentValue.getEntityName())) {
  List<GenericValue> shipmentItemBillings = 
delegator.findByAnd("ShipmentItemBilling", UtilMisc.toMap("shipmentId", 
currentValue.get("shipmentId")), null, false);
  if (UtilValidate.isEmpty(shipmentItemBillings)) {
    // create the ShipmentItemBilling record
    GenericValue shipmentItemBilling = 
delegator.makeValue("ShipmentItemBilling", UtilMisc.toMap("invoiceId", 
invoiceId, "invoiceItemSeqId", invoiceItemSeqId));
    shipmentItemBilling.put("shipmentId", currentValue.get("shipmentId"));
    shipmentItemBilling.put("shipmentItemSeqId", 
currentValue.get("shipmentItemSeqId"));
    shipmentItemBilling.create();
  }
}
{code}

If I read it correctly, this will only create one ShipmentItemBilling for the 
first InvoiceItem only, i.e. 
one ShipmentItemBilling record for each invoiceId and shipmentId and several 
invoiceItemSeqId will be missing it
The good news is that ShipmentItemBilling is not used much currently but until 
the bug is fixed the ShipmentItemBilling entity will not contain reliable 
information.




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to