Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0030623Openbravo ERPZ. Otherspublic2015-08-21 13:192015-10-01 03:36
maite 
aferraz 
urgentmajoralways
closedfixed 
5
 
3.0PR15Q4 
dmiguelez
Advanced Payables and Receivables Mngmt
No
0030623: "deposit to" field in Add Payment process does not show all available financial accounts
"deposit to" field in Add Payment process does not show all available financial accounts
1. Create new Financial Account for España org and currency USD. Access Payment Method tab and define any payment method
2. Create Price List for España org and currency USD. Add any product
3. Create Sales Invoice for España org, price list in USD and Payment Method available for Financial account. Add line and process
4. Run Add Payment process and realize that your financial account does not appear in "deposit to" combo
No tags attached.
related to defect 00307123.0PR15Q4 closed aferraz Payment Method not filled when running Add Payment From Invoice and business partner has not default Financial Account 
related to defect 00307193.0PR15Q4 closed aferraz Deposit To in Add Payment should only show financial accounts where selected payment method is active 
related to design defect 0030807 new Triage Platform Base review login in AdvancedQueryBuilder.substituteContextParameters 
related to defect 00306413.0PR15Q4 closed aferraz Payment Method not reloaded when setting Business Partner in Add Payment process from Transaction tab 
diff issue-30623.diff (2,045) 2015-09-09 17:13
https://issues.openbravo.com/file_download.php?file_id=8440&type=bug
Issue History
2015-08-21 13:19maiteNew Issue
2015-08-21 13:19maiteAssigned To => Triage Finance
2015-08-21 13:19maiteModules => Core
2015-08-21 13:19maiteResolution time => 1442959200
2015-08-21 13:19maiteTriggers an Emergency Pack => No
2015-08-21 13:19maiteIssue Monitored: networkb
2015-08-21 13:20maiteModulesCore => Advanced Payables and Receivables Mngmt
2015-08-28 07:20AtulOpenbravoAssigned ToTriage Finance => AtulOpenbravo
2015-09-01 19:26aferrazAssigned ToAtulOpenbravo => aferraz
2015-09-01 19:26aferrazStatusnew => scheduled
2015-09-02 10:31aferrazRelationship addedrelated to 0030712
2015-09-02 10:31aferrazRelationship addedrelated to 0030719
2015-09-02 11:30aferrazNote Added: 0080016
2015-09-02 11:31aferrazStatusscheduled => feedback
2015-09-02 11:31aferrazAssigned Toaferraz => platform
2015-09-02 11:31aferrazStatusfeedback => new
2015-09-08 10:17alostaleStatusnew => scheduled
2015-09-08 10:17alostaleAssigned Toplatform => alostale
2015-09-08 10:17alostaleReview Assigned To => AugustoMauch
2015-09-09 17:13alostaleNote Added: 0080284
2015-09-09 17:13alostaleFile Added: issue-30623.diff
2015-09-09 17:13alostaleReview Assigned ToAugustoMauch =>
2015-09-09 17:13alostaleStatusscheduled => feedback
2015-09-09 17:14alostaleAssigned Toalostale => Triage Finance
2015-09-09 17:14alostaleStatusfeedback => new
2015-09-09 17:57vmromanosAssigned ToTriage Finance => aferraz
2015-09-10 08:05alostaleRelationship addedrelated to 0030807
2015-09-10 09:58aferrazStatusnew => scheduled
2015-09-10 12:56aferrazRelationship addedrelated to 0030641
2015-09-10 13:18aferrazNote Added: 0080316
2015-09-14 11:36psanjuanNote Edited: 0080316bug_revision_view_page.php?bugnote_id=0080316#r9425
2015-09-14 12:20psanjuanNote Edited: 0080316bug_revision_view_page.php?bugnote_id=0080316#r9426
2015-09-14 12:21psanjuanNote Edited: 0080316bug_revision_view_page.php?bugnote_id=0080316#r9427
2015-09-14 12:44psanjuanNote Edited: 0080316bug_revision_view_page.php?bugnote_id=0080316#r9428
2015-09-14 12:53psanjuanNote Edited: 0080316bug_revision_view_page.php?bugnote_id=0080316#r9429
2015-09-14 13:02psanjuanNote Added: 0080367
2015-09-14 13:24hgbotCheckin
2015-09-14 13:24hgbotNote Added: 0080371
2015-09-14 13:24hgbotStatusscheduled => resolved
2015-09-14 13:24hgbotResolutionopen => fixed
2015-09-14 13:24hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/d45d2896cfa67aa2139e1cc9edbcc0f04f2b1aec [^]
2015-09-14 13:25dmiguelezReview Assigned To => dmiguelez
2015-09-14 13:25dmiguelezNote Added: 0080372
2015-09-14 13:25dmiguelezStatusresolved => closed
2015-09-14 20:30hudsonbotCheckin
2015-09-14 20:30hudsonbotNote Added: 0080390
2015-09-29 16:43hgbotCheckin
2015-09-29 16:43hgbotNote Added: 0080711
2015-10-01 03:36hudsonbotCheckin
2015-10-01 03:36hudsonbotNote Added: 0080762

Notes
(0080016)
aferraz   
2015-09-02 11:30   
Selector query is correct and is the following:

@fin_paymentmethod_id@ is null
or exists (
select 1 from FinancialMgmtFinAccPaymentMethod fpm
join fpm.account as fa
where fpm.paymentMethod.id = @fin_paymentmethod_id@
and fa = e
and (case when @issotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true
and (@c_currency_id@ = fa.currency.id or (case when @issotrx@ = 'true' then fpm.payinIsMulticurrency else fpm.payoutIsMulticurrency end) = true)
and fpm.active = true)

The problem is while building the selector query in AdvancedQueryBuilder.java, when looking if @c_currency_id@ parameter is an ID in line 1222.

Although parameter is an ID, tabId is empty because selector is inside a Process Definition, so instead of getting @c_currency_id@ from Sales Invoice Header tab (where @c_currency_id@ is USD), it will be retrieved from context (where @c_currency_id@ is EUR).
(0080284)
alostale   
2015-09-09 17:13   
Value for c_currency_id parameter is tried to be obtained always from session because it is not part of the request coming from the parent tab (see DD 0030807).

Currency value would be obtained from request context (this is Sales Invoice Header) renaming it to @@inpcCurrencyId@.

See attached proposed fix.
(0080316)
aferraz   
2015-09-10 13:18   
(edited on: 2015-09-14 12:53)
Test plan:

As F&B Admin:

- Create new Financial Account for España org and currency USD. Access Payment Method tab and define "Al contado" payment method
- Create Sales Price List for España org and currency USD. Add any product
- Create Sales Invoice for España org, price list in USD and Payment Method available for Financial account. Add line and process
- Run Add Payment process and realize that your financial account appears in "deposit to" combo.

- Go to Financial Account Caja and set "Al Contado" payment method as payment in in multiple currencies allowed = true.
- Move back to created Sales Invoice and run Add Payment. Realize created financial account appears as default but if you click on selector "Caja" financial account also appears.

- Go to Financial Account Caja and set "Al Contado" payment method as default = true.
- Move to created Financial Account and set payment method as default = false.
- Move back to created Sales Invoice and run Add Payment. Realize "Caja" financial account appears as default but if you click on selector created financial account also appears.

- Go to Financial Account Caja and set "Al Contado" payment method as payment in allowed = false.
- Move back to created Sales Invoice and run Add Payment. Realize created financial account appears as default and if you click on selector "Caja" payment method does not appear anymore.

Repeat the same test opening Add Payment from Sales Order, Purchase Order and Purchase Invoice.

(0080367)
psanjuan   
2015-09-14 13:02   
All steps above have been successfully verified for Sales/Purchase order and Sales/Purchase Invoice.

Issue can be closed.
(0080371)
hgbot   
2015-09-14 13:24   
Repository: erp/devel/pi
Changeset: d45d2896cfa67aa2139e1cc9edbcc0f04f2b1aec
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Sep 10 12:55:34 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d45d2896cfa67aa2139e1cc9edbcc0f04f2b1aec [^]

Fixes issue 30623: Deposit to does not show all availabe Financial Accounts

Deposit To selector query in Add Payment process does not get correctly currency parameter. @inpcCurrencyId@ should be used instead of @c_currency_id@, in order to get document currency instead of context curreny.
Also, getFinancialAccountPaymentMethod method in AddPaymentDefaultValuesHandler has been updated to be similar to Payment Method (when calling from getDefaultPaymentMethod) and Deposit To (when calling from getDefaultFinancialAccount) selector queries:
It will take into account if current Payment Method allows payment in/out (depending on issotrx).
It will take into account if Financial Account currency is the same as document currency or if Financial Account allows multicurrency payment in/out (depending on issotrx) in case of Deposit To selector.
It will order by default field to retrieve first Payment Methods setted as default.

---
M modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java
---
(0080372)
dmiguelez   
2015-09-14 13:25   
Code Review + Testing Ok
(0080390)
hudsonbot   
2015-09-14 20:30   
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/1b0f25004f74 [^]
Maturity status: Test
(0080711)
hgbot   
2015-09-29 16:43   
Repository: erp/devel/pi
Changeset: d57ecc399f7466ee494b75514a96a12b8185cdbe
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Mon Sep 28 17:24:17 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d57ecc399f7466ee494b75514a96a12b8185cdbe [^]

Related to issue 30623: Check account is active

Check in getFinancialAccountPaymentMethod financial account is also active.

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java
---
(0080762)
hudsonbot   
2015-10-01 03:36   
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/f63a11a49473 [^]
Maturity status: Test