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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0047707
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 07. Sales managementmajoralways2021-09-16 16:542021-10-06 08:45
ReporterlbressanView Statuspublic 
Assigned Tovmromanos 
PrioritynormalResolutionfixedFixed in VersionPR22Q1
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0047707: Wrong amount when adding a new line in the payment plan modification

DescriptionWrong amount when adding a new line in the payment plan modification in sales invoice.
Module: org.openbravo.advpaymentmngt
Steps To Reproduce1)Go to the "sales invoice" window

2) Create a new invoice

3) When creating the invoice, complete the data and in "Payment Conditions" choose the option "20% after 15 days, 40% after 30 days and the rest after 60 days" or another similar option.

4) Add some lines with products, in "Invoiced quantity" enter an amount, for example, "100".

5) Complete the sales invoice.

6) Select the "Payment Plan" and click in the button called "Modify Payment Plan"

6) Delete some payments

7) Add a payment that will appear in "0", for example: 10.

8) Add another payment where a negative amount appears, for example: -10
TagsNo tags attached.
Attached Fileszip file icon ticket28640.zip [^] (966,471 bytes) 2021-09-16 16:54

- Relationships Relation Graph ] Dependency Graph ]
depends on defect 0047798 newTriage Platform Base Tab --> Remove Function weird behavior 
depends on defect 0047799 newTriage Platform Base Tab --> Add Function different problems with the new record created 
Not all the children of this issue are yet resolved or closed.

-  Notes
(0131926)
vmromanos (manager)
2021-09-20 13:29

Filled due date from the regression date
(0132102)
hgbot (developer)
2021-10-01 18:42

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/437 [^]
(0132131)
vmromanos (manager)
2021-10-04 13:35

Test plan:

As System Admin.
Go to Window, Tabs and Fields. Search for Sales Invoice window.
Select Payment Plan tab.
Search for the Modify Payment Plan field which is hidden.
Set Displayed = Y

Change role to F&B group admin
Go to Payment Term window.
Create a header for * org
 - Overdue Payment Days Rule : 100
Create the following lines:
 - Percentage due: 25, Overdue Payment Days Rule: 10
 - Percentage due: 35, Overdue Payment Days Rule: 15
 - Percentage due: 20, Overdue Payment Days Rule: 90

Go to Sales Invoice window and create a new record. Select the above payment term in the header.
Enter any line with some amount (greater than 100 for easier testing).
Complete the invoice.

Go to Payment Plan tab and select any record.
Press Modify Payment Plan button.
A grid is opened with several lines.

Delete any of the lines.
Now create a new one. Verify the outstanding amount = expected amount, and it's exactly the same amount as the record previously removed.
Set a lower outstanding amount and press enter.
Enter a new record. Verify the proposed outstanding amount is the amount you have just subtract in the previous record.
Verify the amounts match and press Submit.
Verify the payment plan is successfully updated.

Now partially pay a payment plan line through the Add Payment button. Make sure you leave some amount pending to be paid in the payment plan line.
Open the Modify Payment Plan process.
Decrease the outstanding amount of the payment plan line partially paid.
Now enter a new line. Verify the outstanding amount proposed is the amount you have just subtract in the previous record.
Cancel the changes.

Now fully pay the previously partially paid payment plan line through the Add Payment button.
Open the Modify Payment Plan process. Check the fully paid line is not shown anymore.
Delete any of the lines.
Now create a new one. Verify the outstanding amount = expected amount, and it's exactly the same amount as the record previously removed.



Note that there are two weird behaviors that are outside of the scope of this fix:
- Payment Method is not properly defaulted when creating a new record.
- You need to press Enter (or click into another row's outstanding amount) for a proper validation.
See 0047799 for details
(0132180)
hgbot (developer)
2021-10-06 08:45

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/437 [^]
(0132181)
hgbot (developer)
2021-10-06 08:45

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: ba5b80a20c408e5e3186292f93c392497ad990a4
Author: Víctor Martínez Romanos <victor.martinez@openbravo.com>
Date: 2021-10-04T13:39:29+02:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/ba5b80a20c408e5e3186292f93c392497ad990a4 [^]

Fixed ISSUE-47707: Modify Payment Plan wrong amounts autocalculated

Important: this is a partial fix that improves the situation in most
of the scenarios, but not in all. The platform used to validate and
generate new records is very weak and makes it impossible to properly
control all the scenarios. See 0047798 and 0047799 for details.

The main problem was while trying to retrieve the invoice header information.
The code was wrongly using "grid.view.parentWindow.activeView.getContextInfo"
which retrieves the Payment Plan record. Now we use
"grid.view.parentWindow.views[0].getContextInfo" to get the invoice header info.

totalExpected and totalReceived calculations were not used, so they are removed.

When adding a new record (OB.APRM.addNew) the calculation was doing:
outstandingAmt = Sum(GridExpected) - Sum(GridReceived) - Sum(GridOutstanding)

This algorithm won't work in the moment we delete a record in the grid.

Instead the algorithm now calculates the outstanding amount as:
outstandingAmt = invoiceOutstandingAmt - Sum(GridOutstandingAmt)

This is safer because it works with these scenarios:
1) If no payment plan is fully paid yet. Then all the records are displayed in the grid.
2) If there is any payment plan fully paid. Then those paid payment plans are not displayed.
3) If the user has changed any outstanding amount before creating the new record.

Then, the new record's expected amount is set equal to the calculated outstanding amount,
because it's a new record so both amount should always match.
If there are more adjustements in other lines' outstanding amount, the expected amounts will be
automatically recalculated.

The payment method information set in the new record is removed because the
"selectedRecord" object doesn't have this information. Instead, the payment method (and
any other information should be given in the moment of creating the new object by cloning
and existing one).

---
M modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js
---

- Issue History
Date Modified Username Field Change
2021-09-16 16:54 lbressan New Issue
2021-09-16 16:54 lbressan Assigned To => Triage Finance
2021-09-16 16:54 lbressan File Added: ticket28640.zip
2021-09-16 16:54 lbressan Modules => Core
2021-09-16 16:54 lbressan Regression date => 2021-10-01
2021-09-16 16:54 lbressan Triggers an Emergency Pack => No
2021-09-17 07:55 ivancaceres Issue Monitored: ivancaceres
2021-09-18 12:13 eugeni Issue Monitored: eugeni
2021-09-20 13:29 vmromanos Regression date 2021-10-01 =>
2021-09-20 13:29 vmromanos Note Added: 0131926
2021-09-20 13:48 vmromanos Assigned To Triage Finance => aferraz
2021-09-20 13:48 vmromanos Status new => acknowledged
2021-10-01 17:53 vmromanos Status acknowledged => scheduled
2021-10-01 17:53 vmromanos Assigned To aferraz => vmromanos
2021-10-01 18:20 vmromanos Relationship added depends on 0047798
2021-10-01 18:20 vmromanos Relationship added depends on 0047799
2021-10-01 18:42 hgbot Note Added: 0132102
2021-10-04 13:35 vmromanos Note Added: 0132131
2021-10-06 08:45 hgbot Note Added: 0132180
2021-10-06 08:45 hgbot Resolution open => fixed
2021-10-06 08:45 hgbot Status scheduled => closed
2021-10-06 08:45 hgbot Fixed in Version => PR22Q1
2021-10-06 08:45 hgbot Note Added: 0132181


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker