Openbravo Issue Tracking System - Modules
View Issue Details
0039064ModulesSAP Connectorpublic2018-07-30 12:452018-08-22 10:24
gorkaion 
nonofrancisco 
urgentmajorhave not tried
closedfixed 
5
 
 
aferraz
0039064: Payment details not added when a layaway is partially paid.
Having a Layaway that it is partially paid and the generated Sales Invoice payment plan is split in 2. one with the payments and the other one with the outstanding amount.

When the PUBON is exported the payments are not included.

The getPaymentMethodLines() method is considering only 1 of the payment plans. In case it takes the one with the outstanding amount the payments are not included. See proposed solution.
Create a Sales Invoice with several payment plan records. Try to export it. Check that only the data from a payment plan is included.

How to generate an invoice with several payment plans:
- Assign a split payment terms to Arturo Montoro.
- Enable the "Pay on Credit" and assign a credit limit to Arturo Montoro.
- Refresh the POS and create a ticket partially paid leaving the remaining amoutn on credit.
- Do the cashup to generate the invoice and check that it has 2 payment plans.

- Alternatively it is possible use the generate the invoice on ticket completion with the same result.
Some errors found in the InvoiceJavaPropertyMappingHandler.getPaymentMethodLines() method:

  protected List<SynchronizableBusinessObject> getPaymentMethodLines(Invoice invoice) {
    List<SynchronizableBusinessObject> sbos = new ArrayList<>();
    List<FIN_PaymentSchedule> invoicePaymentsSchedule = invoice.getFINPaymentScheduleList();

    if (!invoicePaymentsSchedule.isEmpty()) {
      for (FIN_PaymentScheduleDetail paymentDetails : invoicePaymentsSchedule.get(0)
          .getFINPaymentScheduleDetailInvoicePaymentScheduleList()) {
        if (paymentDetails.getAPRMPaymentMethod() != null
            && paymentDetails.getAPRMFinancialAccount() != null) {
          SynchronizableBusinessObject sbo = getPaymentMethodLines(paymentDetails);
          processPaymentDetail(sbo, paymentDetails);
          sbos.add(sbo);
        }
      }
    }
    return sbos;
  }

Attached a diff with a proposal fix.

1. invoicePaymentsSchedule.get(0) -> It is considering invoices with a single payment plan:
  This is wrong, it is possible to have split payments so all payment schedules should be iterated.
2. paymentDetails.getAPRMPaymentMethod() and paymentDetails.getAPRMFinancialAccount():
  These are computed columns. So it is required to compute them before accessing their values
  paymentDetails.get_computedColumns().getAPRMFinancialAccount()
3. The computed columns are not considering payments with total amount 0. Is this the expected behavior in order to include the payment amount in the pubon?
  The Payment Method and Financial account are mandatory fields of the Payment entity. The code could be simplified to check if the paymentDetails is related to a "FIN_PaymetnDetail"
  if (paymentDetails.getPaymentDetails() != null)

  and to get the method and account:
  paymentDetails.getPaymentDetails().getFinPayment().getPaymentMethod()
  paymentDetails.getPaymentDetails().getFinPayment().getAccount()

No tags attached.
diff paymentsMissingInPUBON.diff (4,141) 2018-07-30 12:45
https://issues.openbravo.com/file_download.php?file_id=12016&type=bug
patch issue-39064.patch (4,715) 2018-08-17 21:48
https://issues.openbravo.com/file_download.php?file_id=12057&type=bug
Issue History
2018-07-30 12:45gorkaionNew Issue
2018-07-30 12:45gorkaionAssigned To => platform
2018-07-30 12:45gorkaionFile Added: paymentsMissingInPUBON.diff
2018-07-30 12:45gorkaionResolution time => 1534716000
2018-08-13 14:05gorkaionAssigned Toplatform => Triage Finance
2018-08-16 08:18SandrahuguetAssigned ToTriage Finance => nonofrancisco
2018-08-16 10:56SandrahuguetAssigned Tononofrancisco => Triage Finance
2018-08-16 11:12aferrazAssigned ToTriage Finance => nonofrancisco
2018-08-17 12:34gorkaionSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17542#r17542
2018-08-17 21:48nonofranciscoFile Added: issue-39064.patch
2018-08-21 14:49hgbotCheckin
2018-08-21 14:49hgbotNote Added: 0106429
2018-08-21 14:49hgbotStatusnew => resolved
2018-08-21 14:49hgbotResolutionopen => fixed
2018-08-21 14:49hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.service.integration.sap.ecc.mappings/rev/a9aa182dbcd678f74a5d3a8c8b06bd24c8402476 [^]
2018-08-21 14:50aferrazReview Assigned To => aferraz
2018-08-21 14:50aferrazNote Added: 0106430
2018-08-21 14:50aferrazStatusresolved => closed
2018-08-22 10:23hgbotCheckin
2018-08-22 10:23hgbotNote Added: 0106440
2018-08-22 10:24aferrazNote Deleted: 0106430
2018-08-22 10:24aferrazNote Added: 0106441

Notes
(0106429)
hgbot   
2018-08-21 14:49   
Repository: erp/pmods/org.openbravo.service.integration.sap.ecc.mappings
Changeset: a9aa182dbcd678f74a5d3a8c8b06bd24c8402476
Author: Nono Carballo <nonofce <at> gmail.com>
Date: Fri Aug 17 16:00:16 2018 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.integration.sap.ecc.mappings/rev/a9aa182dbcd678f74a5d3a8c8b06bd24c8402476 [^]

Fixes issue 39064: Exporting payments from all invoice payments plan.

- When exporting payment information in WPUBON, all payment plans are
  considered, not just the first one.
- Payment method SAP_CODE and currency ISO_CODE are taken from payment attached
  to payment detail.

---
M src/org/openbravo/service/integration/sap/ecc/mappings/javamapper/InvoiceJavaPropertyMappingHandler.java
---
(0106440)
hgbot   
2018-08-22 10:23   
Repository: erp/pmods/org.openbravo.service.integration.sap.ecc.mappings
Changeset: 533b5fe7498d632c89dd0332bfeec0d7c85df463
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Aug 22 10:19:25 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.integration.sap.ecc.mappings/rev/533b5fe7498d632c89dd0332bfeec0d7c85df463 [^]

Related to issue 39064: Scale amount based in the currency standard precision

---
M src/org/openbravo/service/integration/sap/ecc/mappings/javamapper/InvoiceJavaPropertyMappingHandler.java
---
(0106441)
aferraz   
2018-08-22 10:24   
Reviewed.