Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0047799Openbravo ERPA. Platformpublic2021-10-01 17:522022-02-01 07:24
vmromanos 
Triage Platform Base 
normalmajoralways
newopen 
5
 
 
Core
No
0047799: Tab --> Add Function different problems with the new record created
Discovered in the Modify Payment Plan feature.


There is an Add Function defined into the tab (OB.APRM.addNew).
There is a Validation Function defined into one of the fields (Outstanding --> OB.APRM.validateModifyPaymentPlanAmounts)

The implementation uses:
  returnObject = isc.addProperties({}, allRows[0]);
to clone an existing record from the grid to use it as a template. Some properties are modified and then it is returned by the function.

The record is added to the grid after executing the function, however the following problems have been detected:

1) The validation function associated to the field is not executed after returning the record.
This behavior is not consistent if we compare with the Remove Function which is executed (see 0047798)

2) The fields associated to a foreign key (Payment Method in my case) are not properly populated in the new record.
Not sure if this is related to the function used to clone the record or anything else. In any case, it should be provided an API to be able to clone a record ready to be added to the grid.

3) If I manually edit the field associated to the validation function just after creating the new record, the validation function's item.grid.data.allRows doesn't have yet the newly created record.
However, in the moment I press over the same field in another record, the validation function is called again, but this time the item.grid.data.allRows does have the record.
This behavior makes it very difficult to implement a consistent validation function.

4) The item.grid.data.allRows doesn't have updated information.

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 for Norte organization. Select the above payment term in the header and use "Transferencia" payment method.
Enter any line with some amount.
Complete the invoice.

Go to Payment Plan tab and select any record.
Press Modify Payment Plan button.
A grid is opened with several lines.
Set a break point over the OB.APRM.validateModifyPaymentPlanAmounts function
Delete any of the lines.
Create a new line. Verify that:
 - The validation function is not executed [point (1) above]
 - The Payment method is not "Transferencia" but "Al Contado" (the first item in alphabetic order). It should be set to Transferencia as I'm cloning from a record with Transferencia payment method [point (2) above]
Now edit the Outstanding amount and set something lower. Press in an empty space of the grid. The validation function is run, but the item.grid.data.allRows has 3 records when it should have 4 [point (3) above]
Now select the Outstanding amount of any other record. The validation function is run, but the item.grid.data.allRows has now 4 records. This is OK, but is not consistent with previous scenario [point (3) above].
Cancel the popup.
Press again Modify Payment Plan button.
Delete any of the lines.
Create a new line and change the outstanding amount to a lower value.
Now enter a new line. The validation function's item.grid.data.allRows has the original outstanding amount and not the new lower amount. This means you can't trust in the information that you receive in the function. [point (4) above]
1) Validation function should be run after creating the new record
2) Validation function should always receive in item.grid.data.allRows all the available rows (old and the newly created)
3) The clone feature should be able to work with FK fields
4) The information that you receive in the validation and new functions must be updated
No tags attached.
related to defect 0047798 new Triage Platform Base Tab --> Remove Function weird behavior 
blocks defect 0047707 closed vmromanos Wrong amount when adding a new line in the payment plan modification 
Issue History
2021-10-01 17:52vmromanosNew Issue
2021-10-01 17:52vmromanosAssigned To => platform
2021-10-01 17:52vmromanosModules => Core
2021-10-01 17:52vmromanosTriggers an Emergency Pack => No
2021-10-01 17:52vmromanosIssue generated from0047798
2021-10-01 17:52vmromanosRelationship addedrelated to 0047798
2021-10-01 18:05vmromanosDescription Updatedbug_revision_view_page.php?rev_id=23131#r23131
2021-10-01 18:05vmromanosSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=23133#r23133
2021-10-01 18:05vmromanosProposed Solution updated
2021-10-01 18:20vmromanosRelationship addedblocks 0047707
2022-02-01 07:24alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.