Read Only Logic - Tab - Not Working

Help
Matt
2012-06-19
2013-03-08
  • Matt
    Matt
    2012-06-19

    I have a tab hierarchy in a window and I would like to essentially disable all tabs under a parent tab, under a certain condition (when a field is empty).

    I have been trying to use Read Only Logic on the child tabs and using this field as the criteria, but nothing has been working.

    I have even tried it on different tabs and different fields and I can never get the tab to become read-only.

    What am I doing wrong?

     
  • KittiU
    KittiU
    2012-06-19

    Hi,

    I tried and it works, i.e., putting @AlertSubject@='' in Alert tab and the sub tab also diabled. What is your Read-Only Logic like?

    Kitti U.

     
  • KittiU
    KittiU
    2012-06-19

    Or, have you logout and re-login?

     
  • Matt
    Matt
    2012-06-19

    Are you sure kittiu?

    It looks like they are read-only, but actually the records are just not active.
    You can still create and delete records.

     
  • Matt
    Matt
    2012-06-19

    I am using read-only logic code exactly like yours.

     
  • Mark Ostermann
    Mark Ostermann
    2012-06-19

    Hello Freshquiz,
    please post your example here (what window, tab, field) and how your codesnippet looks like. Perhaps someone can find the issue then.

    Have you compared your snippet with existing examples in the database? Here is a sql you can select other examples where this functionality is working:

    select * 
    from ad_tab 
    where true
    and displaylogic <> ''
    or readonlylogic <> ''
    

    Greetings from Sankt Augustin.
    Mark
    __________
    just an ADempiere citizen, and ADempiere Functional Team member, and active ADempiere e.V. Member and …
    … i'm earning my living with ADempiere labour

     
  • Matt
    Matt
    2012-06-20

    Thanks for the query Mark. Yeah mine is very similar to the existing read-only logic.

    Mine is just something like: @micob_num@=1
    Where micob_num is the column in the table and the name of the field is: MICOB Number.
    I am supposed to use the column name right? I tried both anyway.

    So I still can't get any read-only logic to work, but if I ever do, is it possible to access the value of a field/column from a parent/child tab? So in my child tabs I would like to check the value of a field/column in a parent tab.

     
  • Hi,

    as far as I remember the logict is case sensitive. You can check the context by opening Tools->Preference from the window menu and select the 'Context' tab. Here you will find the correct spelling/case of your context variable.

    Hope that helps..

    Best regards,
    Karsten

     
  • Mark Ostermann
    Mark Ostermann
    2012-06-20

    Hello Matt.
    Please open your mentioned window and check the context variables (Tools>Settings>Context).
    Can you find your field in the context? Is it written in lower cases or is it written like Micob_Num or something else?

    I am supposed to use the column name right?

    Yes, that's right, BUT it's the column name from ADempiere (in ad_column), and ther you can have uppercase/ lowercase columnnames. And the columnname from there is put into ADempiere context with uppercase/ lowercase too. And your @micob_num@ in readonly logic refers to that context variable.

    Hope this helps.

    Greetings from Sankt Augustin.
    Mark
    __________
    just an ADempiere citizen, and ADempiere Functional Team member, and active ADempiere e.V. Member and …
    … i'm earning my living with ADempiere labour

     
  • Matt
    Matt
    2012-06-20

    I had already done that guys (looking at the available context variables).

    There is no issue with case, I have that right.

    Does read-only mean: cannot create/delete records and cannot edit records?

     
  • Mark Ostermann
    Mark Ostermann
    2012-06-21

    Morning Matt.

    Does read-only mean: cannot create/delete records and cannot edit records?

    Yes, exactly. An example how Read-Only looks like would be WIndow "Product", Tab "Located at" (Data not editable, Buttons New, Delete, Copy are deactivated.

    Greetings from Sankt Augustin.
    Mark
    __________
    just an ADempiere citizen, and ADempiere Functional Team member, and active ADempiere e.V. Member and …
    … i'm earning my living with ADempiere labour

     
  • Matt
    Matt
    2012-06-21

    Thanks Mark, so it is what I want, but I just can't get it dynamically via read-only logic.

     
  • Matt
    Matt
    2012-06-21

    Ahh I have finally noticed some form of read-only logic in action.

    The problem is that it seems to be partially read-only. The create/delete/copy/save record buttons are disabled, but I can still edit the records and when I change records, it saves.

    Why doesn't read-only logic make the tab completely read-only like the read-only checkbox does?

     
  • Matt
    Matt
    2012-06-21

    According to this post: https://sourceforge.net/projects/adempiere/forums/forum/610547/topic/5087640

    It seems there is room for accessing context variables from other tabs of the same window, but it seems the code does not allow for it.

    I get the Logic tuple error when I try it. This seems like a bug/limitation in the code to not allow the vertical bar.

    Is there any way to achieve the same effect without modifying the source code?

     
  • Matt
    Matt
    2012-06-22

    I have solved the problem of accessing context variables from other tabs. I used the idea from mjmckay (Mike), where he said to create virtual columns of the columns from the other tabs and just put the virtual columns in the context variables of the logic.

    So that problem is solved, but now the problem is that read-only logic doesn't completely make a tab read-only. It is buggy in my opinion. The fields are still editable and as a result, saveable. This defeats the purpose of having read-only logic.

    I can't use display logic because that seems to be buggy as well. The tab only hides when you click on it and as a result, once it is hidden, it can never be shown again.
    It should hide/show itself automatically and not be clicked on.

    Does anyone know how to fix this read-only logic flaw without modifying the source code?

     
  • xolali
    xolali
    2012-07-11

    Hi,
    Sorry this cant be solved without writing code. Luckily someone already fixed it and it works
    https://sourceforge.net/projects/adempiere/forums/forum/610548/topic/5194468

    I think it should be added to trunk cos its a very useful bug fix.
    I noticed that for similar column names you can have problem accessing in between tabs so you can use the virtual column trick. But where the name is unique across tabs, it works, just tried.

    Thanks
    xolali