Openbravo Issue Tracking System - Modules
View Issue Details
0032572ModulesRemittancepublic2016-04-01 13:512016-05-06 10:51
psanjuan 
AtulOpenbravo 
urgentmajoralways
closedfixed 
20Ubuntu 8.04.1
 
 
aferraz
0032572: Settle remittance process needs to check if the payment being settle is already created in the financial account.
Settle remittance process needs to check if the payment being settle is already created in the financial account.
Create a Sales Invoice with Remittance payment method and complete it.

Go to the Financial Account related to Remittance Payment method.

Create a financial account transaction, Transaction Type "BP Deposit".

Add a payment by using (+) option.
Filter by "Remittance" payment method in the "Add Payment" window.
Select the invoice created. Enter the Actual Payment amount.
Process Received Payment(s).

Navigate to the Payment In created. Check that it has "Awaiting Execution" status.

That payment can be included in a remittance by using the option "Select Payments", or it can be executed from the Payment IN window.

Navigate to the remittance just created, the one including the payment created and process it.

Go back to the payment in and check its status has changed to "Remitted".

Go back to the Financial Account and check that the transaction can now be processed, therefore its status changes to "Deposited not cleared".

Go to settle and protest remittance and settle the remittance dated on 31/12/2016. An error is shown: see image below:

See log:

c59635e2 836771 [http-8080-6] DEBUG reloadXml - XmlEngine 29-11-2001 Initialized
c59635e2 836821 [http-8080-6] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 update FIN_Payment set Updated='2016-03-23 15:08:31.252000 +01:00:00', Status='RPR' where Fin_Payment_ID='4847E25D0E404D67A17AE750919EF342' was aborted. Call getNextException to see the cause.
c59635e2 836822 [http-8080-6] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: current transaction is aborted, commands ignored until end of transaction block
Mar 23, 2016 3:08:31 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet XDB8EC5133C324B87992A8F88CED04961 threw exception
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
    at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
    at org.openbravo.dal.service.OBDal.flush(OBDal.java:205)
    at org.openbravo.dal.core.SessionHandler.flushRemainingChanges(SessionHandler.java:323)
    at org.openbravo.dal.core.SessionHandler.commitAndClose(SessionHandler.java:266)
    at org.openbravo.dal.core.DalThreadHandler.doFinal(DalThreadHandler.java:51)
    at org.openbravo.dal.core.DalRequestFilter$1.doFinal(DalRequestFilter.java:99)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:65)
    at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:103)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:701)
Caused by: java.sql.BatchUpdateException: Batch entry 0 update FIN_Payment set Updated='2016-03-23 15:08:31.252000 +01:00:00', Status='RPR' where Fin_Payment_ID='4847E25D0E404D67A17AE750919EF342' was aborted. Call getNextException to see the cause.
    at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2762)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1999)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:421)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2929)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
    ... 24 more

As a consequence of that, it should be possible to CREATE a transaction in the financial account related to an "In Remittance" execution process, deferred or not; but settle process needs to check whether there is a payment already created in the financial account or not.

If it is already created an error needs to be shown so the end-user manually deletes that payment in the financial account.
An error needs to be shown if there is a payment already created in the financial account (Not processed), at the time of processing remittance settle of that payment (because remittance settle creates the payment in the financial account); therefore end-user can go to the financial account and delete the payment so that remittance settle can be processed.

This scenario is considered as an exception to the "normal" remittance work-flow.
No tags attached.
related to defect 0032573 closed AtulOpenbravo Openbravo ERP It is not possible to execute a payment created in the financial account if it is set up as "Automatic Deposit". 
caused by feature request 0029387 closed Sandrahuguet Openbravo ERP Transaction refactor project 
related to defect 0032383 closed AtulOpenbravo Openbravo ERP Payments can be deposited without being executed when adding a payment to an invoice through the financial account transaction 
Issue History
2016-04-01 13:51psanjuanNew Issue
2016-04-01 13:51psanjuanAssigned To => Triage Finance
2016-04-01 13:51psanjuanRelationship addedrelated to 0032383
2016-04-01 13:56psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11621#r11621
2016-04-01 13:56psanjuanProposed Solution updated
2016-04-01 14:24ngarciaIssue Monitored: ngarcia
2016-04-07 18:23AtulOpenbravoNote Added: 0085504
2016-04-07 18:26AtulOpenbravoStatusnew => scheduled
2016-04-08 13:00psanjuanNote Added: 0085530
2016-04-08 13:07psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11720
2016-04-08 13:31psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11723
2016-04-08 13:31psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11724
2016-04-08 13:47psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11725
2016-04-08 13:56psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11726
2016-04-08 13:58psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11727
2016-04-08 14:00psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11728
2016-04-08 14:04psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11729
2016-04-08 14:06psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11730
2016-04-08 14:06psanjuanNote Added: 0085531
2016-04-08 14:17psanjuanNote Deleted: 0085531
2016-04-08 14:19psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11731
2016-04-08 14:26psanjuanNote Added: 0085533
2016-04-12 12:24aferrazAssigned ToTriage Finance => AtulOpenbravo
2016-04-12 14:51psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11750
2016-04-12 14:53psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11751
2016-04-12 15:02psanjuanNote Added: 0085575
2016-04-12 15:10psanjuanNote Edited: 0085530bug_revision_view_page.php?bugnote_id=0085530#r11752
2016-04-13 10:31hgbotCheckin
2016-04-13 10:31hgbotNote Added: 0085587
2016-04-13 10:31hgbotStatusscheduled => resolved
2016-04-13 10:31hgbotResolutionopen => fixed
2016-04-13 10:31hgbotFixed in SCM revision => http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/22313b1c7960a9d98fe29a68585e82a8f0fb7b81 [^]
2016-04-13 10:31hgbotCheckin
2016-04-13 10:31hgbotNote Added: 0085588
2016-04-13 10:31hgbotCheckin
2016-04-13 10:31hgbotNote Added: 0085589
2016-04-13 10:55aferrazReview Assigned To => aferraz
2016-04-13 10:55aferrazNote Added: 0085591
2016-04-13 10:55aferrazStatusresolved => closed
2016-04-13 10:59aferrazRelationship addedrelated to 0032573
2016-04-13 11:04aferrazRelationship addedcaused by 0029387
2016-05-06 10:43hgbotCheckin
2016-05-06 10:43hgbotNote Added: 0086247
2016-05-06 10:43hgbotCheckin
2016-05-06 10:43hgbotNote Added: 0086248
2016-05-06 10:51aferrazNote Deleted: 0085591
2016-05-06 10:51aferrazNote Added: 0086250

Notes
(0085504)
AtulOpenbravo   
2016-04-07 18:23   
Test Plan
- Create a Sales Invoice with Remittance payment method and complete it.
- Go to the Financial Account related to Remittance Payment method.
- Create a financial account transaction, Transaction Type "BP Deposit".
- Add a payment by using (+) option.
  Filter by "Remittance" payment method in the "Add Payment" window.
  Select the invoice created. Enter the Actual Payment amount.
  Process Received Payment(s).
- Navigate to the Payment In created. Check that it has "Awaiting Execution" status.
- That payment can be included in a remittance by using the option "Select Payments", or it can be executed from the Payment IN window.
- Navigate to the remittance just created, the one including the payment created and process it.
- Go back to the payment in and check its status has changed to "Remitted".
- Go back to the Financial Account and check that the transaction can now be processed, therefore its status changes to "Deposited not cleared".
- Go to settle and protest remittance and settle the remittance line for above payment.
- Error will be displayed "Remittance line selected could not be settled as transaction for related payment already created in financial account. Remove it to proceed".
- Go to Financial Account, remove the transaction for related payment of above remittance line.
- Go to to Settle/ Protest Remittance process, settle the remittance line choosen earlier.
- Check the process is completed successfully and now transaction for related payment is created in financial account.
(0085530)
psanjuan   
2016-04-08 13:00   
(edited on: 2016-04-12 15:10)
Test Plan

(*) Scenario 1 - Remittance type "Remit for Discount" = No

Go to Remittance type window and check that "Printable Remittance" remittance type is configured as shown below:
Payment Method = Remittance
Remit for discount = No

Create a Sales Invoice with "Remittance" payment method configured as shown below and complete it.

Execution Process = In remittance
Deferred = yes
Automatic Deposit = No

Go to the Financial Account related to Remittance Payment method.

Create a financial account transaction, Transaction Type "BP Deposit".
Add a payment by using (+) option.
Filter by the BP and "Remittance" payment method in the "Add Payment" window.
Select the invoice created. Enter the Actual Payment amount.
Process Received Payment(s). Press Done.

Back in the "Transaction" tab of financial account window, check that a payment has been created.

Navigate to the Payment In created. Check that it has "Awaiting Execution" status.

Go back to the financial account and try to process the transaction. Below error is shown, which is Ok.

"It is not possible to process a transaction with a payment having an automatic execution process payment method. Please execute the payment in Payment In/Out window first."

Go back to the payment in window and execute the payment by selecting the option "Include in existing remittance or create a new one".

Check that payment in status remains as "Awaiting Execution".
Go to the financial account and try to process the payment. Same error is shown which is OK.

Create another sales invoice for the same BP and Remittance payment method. Complete it.

Go to the Financial Account related to Remittance Payment method.

Create a financial account transaction, Transaction Type "BP Deposit".
Add a payment by using (+) option.
Filter by the BP and "Remittance" payment method in the "Add Payment" window.
Select the invoice created. Enter the Actual Payment amount.
Process Received Payment(s). Press Done.

Back in the "Transaction" tab of financial account window, check that a payment has been created.

Navigate to the payment and execute it by selecting the option "Include in existing remittance or create a new one".

Go to remittance window and check that a new remittance has been created including these two payments just created.

Process the remittance by selecting the option "Not grouping". Press Ok.

Go to the payments and verify that their status has changed to "Remitted", therefore can be processed in the financial account.

Go to the financial account and process those two transactions / payments.

Go to settle/protest window and search by the remittance just created.

Select first payment, enter an accounting date and press settle.
Check that an error is show saying: Remittance line cannot be settled because transaction for related payment is already created in the financial account. Please remove it to proceed." which is correct.

Press Search and select second payment, enter and accounting date and check that same error is shown.

Go to the financial account transaction and remove those transactions /payments by reactive them and delete them.

Go to settle/protest window and search by the remittance just created.

Select first payment, enter an accounting date and press settle. Process completed successfully is shown.
Repeat same steps with second payment. Same result is shown.

Go to financial account transaction and check that payments are now shown in there as processed.

(*) Scenario 2 - Remittance type "Remit for Discount" = No & remittance grouping & single payment option.

Repeat scenario 1 above, that means creation of two sales invoice for same BP, payment method remittance.
Creation of payments in the financial account transaction tab.

Go to payment in window and execute both payments by using the option "include in an existing or new remittance".

Check that a new remittance has been created including these two payment.

Single payment option can not be used while processing "Payments" remittance, therefore that action is not going to conflict with the fact that these two payments are already created in the financial account (data duplication).

Grouped options such as "Group by business partner" is not going to conflict either as it does not apply while including payments in a remittance.

(*) Scenario 3 - Remittance type "Remit for Discount" = Yes

Go to Remittance type window and select Printable Remittance type. Configure it as "Remit for discount " = Yes.
Select "Transferencia" as "Payment Method for discount" as well as a G/L Item (ie. Deuda efectos descontados).

Go to sales invoice and create a new one for BP Alimentos y supermercados and payment method "Remittance". Complete the invoice.

Go to financial account window, transaction tab and create a new record, add a payment by using option (+), dated on 08-04-2016.

Search by the BP Alimentos and payment method Remittance. Select the invoice just created and enter the actual payment amount. Process Received Payment(s). Press Done. (Payment created ie. 354)
Save the transaction and check it can not be processed, that is OK.

Navigate to payment in created and execute it by selecting the option "Include in existing remittance or create a new one". Press Execute.

Go to remittance window and check that a new remittance has been created in there. Enter a discount date (ie. 30-04-2016) and process it.

Verify that a new payment has been created (ie. 355) Navigate to the payment and check its status is "Deposited not cleared".
Go to financial account and check that payments 354 and 355 are in there.

Check that discount payment 355 is already processed and set as deposited not cleared dated on discount date for an amount = 79.86

Check that manually created payment 354, dated on 08-04-2016 can be processed now.

Finally go to settle/process window.

Search by the remittance created. Select payment 354. Enter an accounting date (ie 30-04-2016) and press settle.

Check that an error is shown.

Go to the financial account transaction tab and remove that transactions /payments (354) by reactive it and delete it.

Go to settle/protest window and make sure that payment 354 can now be settle.

(*) Scenario 4 - Protest remittance. (Remittance Not for discount).

Go to sales invoice window and create a new one for Alimentos y Supermercados BP. Remittance payment method.

Create a financial account transaction, Transaction Type "BP Deposit".
Add a payment by using (+) option.
Filter by the BP and "Remittance" payment method in the "Add Payment" window.
Select the invoice created. Enter the Actual Payment amount.
Process Received Payment(s). Press Done.

Back in the "Transaction" tab of financial account window, check that a payment has been created.

Navigate to the Payment In created (ie. 374). Check that it has "Awaiting Execution" status. Execute it.

Check that a new remittance has been created including payment 374. Process it.

Go to the payment in and check its status has changed to "remitted", therefore it can be processed in the financial account. Process it. Verify its status has changed to Deposited Not cleared.

Go to settle/protest window, search by the remittance just created. Enter an accounting date and press Protest.

Check that payment status has changed to Awaiting Execution.
Create another remittance and include once more the payment by using the option (Select Payments). Process remittance.

Go to settle/Protest window, search by last remittance created. Enter an accounting date and press Settle.

Check that the error is shown, which is correct.

Go to the financial account transaction tab and remove that transactions /payments (374) by reactive it and delete it.

Go to settle/protest window and make sure that payment 374 can now be settle.

(*) Scenario 5 - Protest remittance. (Remittance for discount).

Repeat same test case 4 but for remittance for discount.

(*) Repeat same test as above but scenario 3 and 5 for purchase invoice / payment out being remitted.

(0085533)
psanjuan   
2016-04-08 14:26   
Review scenario 3 above. Settle process needs to behave properly also in case of remit for discount.
(0085575)
psanjuan   
2016-04-12 15:02   
Test Plan above verified.

Issue can be code reviewed and closed.
(0085587)
hgbot   
2016-04-13 10:31   
Repository: erp/mods/org.openbravo.module.remittance
Changeset: 22313b1c7960a9d98fe29a68585e82a8f0fb7b81
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Apr 11 23:54:14 2016 +0530
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/22313b1c7960a9d98fe29a68585e82a8f0fb7b81 [^]

Fixes issue 32572:Settle remittance should fail if payment is in FA Transaction

Check is provided before creating financial account transaction whether
record exists or not before settling the remittance line in both cases
Remit for Discount or without it

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/module/remittance/utility/REM_SettleProtest.java
---
(0085588)
hgbot   
2016-04-13 10:31   
Repository: erp/mods/org.openbravo.module.remittance
Changeset: 00cc1aa4d2f0b150008235a799352ae17dac9e09
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Apr 12 20:07:38 2016 +0200
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/00cc1aa4d2f0b150008235a799352ae17dac9e09 [^]

Related to issue 32572: Code review improvements

---
M src/org/openbravo/module/remittance/utility/REM_SettleProtest.java
---
(0085589)
hgbot   
2016-04-13 10:31   
Repository: erp/mods/org.openbravo.module.remittance
Changeset: 0eea892589d24e46dcd44929dd6303ec3ca2825d
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Apr 13 10:26:38 2016 +0200
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/0eea892589d24e46dcd44929dd6303ec3ca2825d [^]

Related to issue 32572: Update module version

---
M src-db/database/sourcedata/AD_MODULE.xml
---
(0086247)
hgbot   
2016-05-06 10:43   
Repository: erp/mods/org.openbravo.module.remittance
Changeset: 80f3b069ce321bd040671fbdc84bb1e6444701f6
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Fri May 06 10:15:07 2016 +0200
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/80f3b069ce321bd040671fbdc84bb1e6444701f6 [^]

Related to issue 32572: Code review improvements

---
M src/org/openbravo/module/remittance/utility/REM_SettleProtest.java
---
(0086248)
hgbot   
2016-05-06 10:43   
Repository: erp/mods/org.openbravo.module.remittance
Changeset: dc8741b9bf45fafd9c674b973315d941a529adfc
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Fri May 06 10:20:34 2016 +0200
URL: http://code.openbravo.com/erp/mods/org.openbravo.module.remittance/rev/dc8741b9bf45fafd9c674b973315d941a529adfc [^]

Related to issue 32572: Update module version

---
M src-db/database/sourcedata/AD_MODULE.xml
M src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
---
(0086250)
aferraz   
2016-05-06 10:51   
Code review OK.

Issue fixed in version 3.2.600 of Remittances infrastructure module.