Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0038273
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 02. Master data managementmajoralways2018-04-05 09:192018-05-09 19:29
ReporterngarciaView Statuspublic 
Assigned Tocollazoandy4 
PriorityurgentResolutionfixedFixed in Version3.0PR18Q3
StatusclosedFix in branchFixed in SCM revision86538f0c0124
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toaferraz
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0038273: Current Balance is not updated if an invoice is completed when Business Partner record is pending to be saved

DescriptionCurrent Balance is not updated if an invoice is completed when Business Partner record is pending to be saved
Steps To ReproduceAs group admin role:
   Go to Business Partner window and select 'Hoteles Buenas Noches, S.A.'
   Check its current balance
   Edit some field such as the Commercial Name
   Do not save it
   Create a Sales Invoice for that business partner, add a line and complete it
   Return to the Business Partner window and save the record
   Check Current Balance remains with the same value and it should have been updated
TagsNo tags attached.
Attached Filesdiff file icon proposal38273.diff [^] (3,253 bytes) 2018-04-06 08:27 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0103705)
dmiguelez (developer)
2018-04-06 08:29

Note:

To fix wrong data UpdateCustomerBalance ModuleScript can be used.

To fix it only for one Business Partner this queries can be used (this is done for the Business Partner used to report the issue)

-- Update CreditUsed to 0
UPDATE c_bpartner SET so_creditused = 0, updatedby='0', updated=now() where c_bpartner_id = '9E6850C866BD4921AD0EB7F7796CE2C7';

-- Retrieve credit used
select SUM(A.amount)
        FROM (
          SELECT bp.c_bpartner_id, COALESCE(SUM(c_currency_convert(ps.outstandingamt * (CASE WHEN inv.issotrx = 'Y' THEN 1 ELSE -1 END), inv.c_currency_id, bp.bp_currency_id, inv.created, null, inv.ad_client_id, inv.ad_org_id)), 0) as amount
          FROM c_invoice inv
          JOIN c_bpartner bp
          ON inv.c_bpartner_id = bp.c_bpartner_id
          JOIN fin_payment_schedule ps
          ON inv.c_invoice_id = ps.c_invoice_id
          WHERE ps.outstandingamt <> 0
          and bp.c_bpartner_id = '9E6850C866BD4921AD0EB7F7796CE2C7'
          GROUP BY bp.c_bpartner_id
          UNION ALL
          SELECT bp.c_bpartner_id, COALESCE(SUM(c_currency_convert((p.generated_credit - p.used_credit) * (CASE WHEN p.isreceipt = 'Y' THEN -1 ELSE 1 END), p.c_currency_id, bp.bp_currency_id, p.created, null, p.ad_client_id, p.ad_org_id)), 0) as amount
          FROM FIN_PAYMENT p
          JOIN c_bpartner bp
          ON p.c_bpartner_id = bp.c_bpartner_id
          WHERE (p.generated_credit - p.used_credit) <> 0
          AND p.generated_credit <> 0
          AND p.processed = 'Y'
          and bp.c_bpartner_id = '9E6850C866BD4921AD0EB7F7796CE2C7'
          GROUP BY bp.c_bpartner_id
        ) A
        GROUP BY A.c_bpartner_id;

-- Set new credit used based on previous query
UPDATE c_bpartner SET so_creditused = TO_NUMBER(XXX), updatedby='0', updated=now() WHERE c_bpartner_id = '9E6850C866BD4921AD0EB7F7796CE2C7';
(0103727)
collazoandy4 (reporter)
2018-04-06 21:45

Test Plan
  As group admin role:
   Go to Business Partner window and select 'Hoteles Buenas Noches, S.A.'
   Check its current balance
   Edit but not save it the Commercial Name field
   Create a Sales Invoice for that business partner, add a line and complete it
   Return to the Business Partner window and save the record
   Check an error message is shown:
     Saving failed. The record you are saving has already been changed by another user or process. Cancel your changes and refresh the data by clicking the refresh button.
(0103855)
hgbot (developer)
2018-04-12 17:15

Repository: erp/devel/pi
Changeset: 86538f0c012469375e97d74760b7f3b265715ef7
Author: Armaignac <collazoandy4 <at> gmail.com>
Date: Fri Apr 06 14:37:01 2018 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/86538f0c012469375e97d74760b7f3b265715ef7 [^]

Fixes issue 38273:Current Balance is not updated if an invoice is completed when
Business Partner record is pending to be saved

If while editing a business partner a sales or purchase update the current balance
this value is lost when the entity is saved because has already been changed by
another user or process.

Now when another user or process update the current balance field while editing
the business partner an error message is shown saving the entity

---
M modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml
M modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_TAX_PAYMENT.xml
M src-db/database/model/functions/C_BP_SOCREDITUSED_REFRESH.xml
---
(0103856)
hgbot (developer)
2018-04-12 17:15

Repository: erp/devel/pi
Changeset: eb8f5d143b9398a5732b92621fd9943801344a1e
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Apr 12 17:07:02 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/eb8f5d143b9398a5732b92621fd9943801344a1e [^]

Related to issue 38273: Update copyright

---
M modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_TAX_PAYMENT.xml
M src-db/database/model/functions/C_BP_SOCREDITUSED_REFRESH.xml
---
(0103857)
aferraz (manager)
2018-04-12 17:15

Code review + Testing OK
(0104378)
hudsonbot (developer)
2018-05-09 19:29

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/2be7d3efe606 [^]
Maturity status: Test
(0104379)
hudsonbot (developer)
2018-05-09 19:29

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/2be7d3efe606 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2018-04-05 09:19 ngarcia New Issue
2018-04-05 09:19 ngarcia Assigned To => Triage Finance
2018-04-05 09:19 ngarcia Modules => Core
2018-04-05 09:19 ngarcia Resolution time => 1524693600
2018-04-05 09:19 ngarcia Triggers an Emergency Pack => No
2018-04-05 09:20 ngarcia Issue Monitored: ngarcia
2018-04-05 15:36 jfrances Issue Monitored: jfrances
2018-04-05 18:02 dmiguelez Assigned To Triage Finance => collazoandy4
2018-04-05 23:19 achaves Issue Monitored: achaves
2018-04-06 08:27 dmiguelez File Added: proposal38273.diff
2018-04-06 08:29 dmiguelez Note Added: 0103705
2018-04-06 20:28 collazoandy4 Status new => scheduled
2018-04-06 21:45 collazoandy4 Note Added: 0103727
2018-04-12 17:15 hgbot Checkin
2018-04-12 17:15 hgbot Note Added: 0103855
2018-04-12 17:15 hgbot Status scheduled => resolved
2018-04-12 17:15 hgbot Resolution open => fixed
2018-04-12 17:15 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/86538f0c012469375e97d74760b7f3b265715ef7 [^]
2018-04-12 17:15 hgbot Checkin
2018-04-12 17:15 hgbot Note Added: 0103856
2018-04-12 17:15 aferraz Review Assigned To => aferraz
2018-04-12 17:15 aferraz Note Added: 0103857
2018-04-12 17:15 aferraz Status resolved => closed
2018-04-12 17:15 aferraz Fixed in Version => 3.0PR18Q3
2018-05-09 19:29 hudsonbot Checkin
2018-05-09 19:29 hudsonbot Note Added: 0104378
2018-05-09 19:29 hudsonbot Checkin
2018-05-09 19:29 hudsonbot Note Added: 0104379


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker