Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0031627Openbravo ERPA. Platformpublic2015-12-01 12:152015-12-23 09:45
caristu 
inigosanchez 
highminoralways
closedfixed 
5
 
3.0PR16Q1 
caristu
Core
No
0031627: Fields with display logic equals to false cause js check error in log
Fields with display logic equals to false cause js check error in log. This errors are displayed in the log only if we have modules in in development status:

>>>>>>> Issues found in javascript <<<<<<<<<
Core.View:3528:46: Weird relation. >> offending code: f.disableItem('customer', (false) === false);
Core.View:3532:44: Weird relation. >> offending code: f.disableItem('vendor', (false) === false);
Core.View:3536:46: Weird relation. >> offending code: f.disableItem('employee', (false) === false);
1) Put core in 'In Development' status
2) Open [Business Partner] window
No tags attached.
related to design defect 0024319 closed inigosanchez Grid mode should hide field content as per display logic rule 
related to defect 00240323.0MP25 closed jonalegriaesarte Save description in purchase invoice is failing when the invoice is booked 
related to defect 0031767 acknowledged Triage Platform Base Weird relation error thrown in the log depending on the read only and display logic values 
Issue History
2015-12-01 12:15caristuNew Issue
2015-12-01 12:15caristuAssigned To => platform
2015-12-01 12:15caristuModules => Core
2015-12-01 12:15caristuTriggers an Emergency Pack => No
2015-12-01 12:16caristuRelationship addedrelated to 0024319
2015-12-01 13:13caristuRelationship addedrelated to 0024032
2015-12-01 13:14caristuAssigned Toplatform => inigosanchez
2015-12-01 13:14caristuStatusnew => acknowledged
2015-12-01 13:32shuehnerIssue Monitored: shuehner
2015-12-10 11:29inigosanchezStatusacknowledged => scheduled
2015-12-13 20:12inigosanchezReview Assigned To => caristu
2015-12-13 20:13hgbotCheckin
2015-12-13 20:13hgbotNote Added: 0082689
2015-12-13 20:13hgbotStatusscheduled => resolved
2015-12-13 20:13hgbotResolutionopen => fixed
2015-12-13 20:13hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/d9584faf499bc5ec6df24ef53abc548a8608d754 [^]
2015-12-13 20:18inigosanchezNote Added: 0082690
2015-12-13 20:18inigosanchezNote Edited: 0082690bug_revision_view_page.php?bugnote_id=0082690#r10454
2015-12-14 01:59hudsonbotCheckin
2015-12-14 01:59hudsonbotNote Added: 0082693
2015-12-14 12:04AugustoMauchNote Added: 0082706
2015-12-14 12:17inigosanchezNote Added: 0082708
2015-12-15 09:54AugustoMauchNote Added: 0082753
2015-12-22 18:43caristuNote Added: 0082948
2015-12-22 18:43caristuStatusresolved => new
2015-12-22 18:43caristuResolutionfixed => open
2015-12-22 18:44caristuNote Edited: 0082948bug_revision_view_page.php?bugnote_id=0082948#r10525
2015-12-22 18:45caristuNote Edited: 0082948bug_revision_view_page.php?bugnote_id=0082948#r10526
2015-12-22 18:46caristuNote Edited: 0082948bug_revision_view_page.php?bugnote_id=0082948#r10527
2015-12-23 09:43caristuStatusnew => scheduled
2015-12-23 09:43caristuStatusscheduled => resolved
2015-12-23 09:43caristuResolutionopen => fixed
2015-12-23 09:45caristuNote Added: 0082954
2015-12-23 09:45caristuStatusresolved => closed
2015-12-23 09:45caristuFixed in Version => 3.0PR16Q1
2015-12-23 09:45caristuRelationship addedrelated to 0031767
2015-12-23 09:46caristuNote Edited: 0082954bug_revision_view_page.php?bugnote_id=0082954#r10531

Notes
(0082689)
hgbot   
2015-12-13 20:13   
Repository: erp/devel/pi
Changeset: d9584faf499bc5ec6df24ef53abc548a8608d754
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Sun Dec 13 18:52:55 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/d9584faf499bc5ec6df24ef53abc548a8608d754 [^]

Fixed issue 31627:Fields with display logic equals to false cause js error

The problem was when a display logic was false (not a condition evaluated
to false) an error is thrown in the console. This error warned about trivial
comparisons (false === false).

To resolved this problem it has been added some condition to check this special
case. When a display logic is false, it is avoid this unecessary comparasion.

Now when a display logic is false is avoid to make this trivial comparison.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-form.js.ftl
---
(0082690)
inigosanchez   
2015-12-13 20:18   
Specially tested in tabs which contain fields where f.displaylogic = 'false':
* Sales Invoice - Lines
* Purchase Invoice - Lines
* Business Partner - Business Partner
* Financial Account - Account

(0082693)
hudsonbot   
2015-12-14 01:59   
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/a26c11c3031d [^]
Maturity status: Test
(0082706)
AugustoMauch   
2015-12-14 12:04   
Does the same error message appears in the log if "true" is used instead of "false" in the display logic of field?
(0082708)
inigosanchez   
2015-12-14 12:17   
In case that "true" value is used there is no problem because errors are thrown when a trivial comparisons are done. For example "(true) === true" or "(false) === false".

This comparison is "(X) === false" for that reason only affects in cases than display logic are false.

It is already tested.
(0082753)
AugustoMauch   
2015-12-15 09:54   
Ok, thanks!

Actually (true) == true (always evaluated to true) is as trivial as (true) == false (always evaluated to false), but for whatever reason the compiler does not complain.
(0082948)
caristu   
2015-12-22 18:43   
(edited on: 2015-12-22 18:46)
There is still one case to be analyzed which is causing the same parsing error in the log:

Steps to reproduce, using the Unit of Measure window:

1) Define a display logic for the symbol field, for example: @name@='Day'
2) Define a fixed read-only logic for the column related to the symbol field, for example: true
3) Open the Unit of Measure window and check the log:

Weird condition. >> offending code: f.disableItem('symbol', (true) || (OB.Utilities.getValue(currentValues,'name') === 'Day') === false);

(0082954)
caristu   
2015-12-23 09:45   
(edited on: 2015-12-23 09:46)
Verified:
- The error does not appear in the log anymore
- Display logic in form and grid continue working fine
- Read only logic works fine

- Created a new issue for the missing case mentioned above: https://issues.openbravo.com/view.php?id=31767 [^]