Set label in red when editor is mandatory and empty on quick entry panels
Description
Environment
Attachments
- 09 Mar 2019, 02:02 PM
- 27 Feb 2019, 08:07 AM
relates to
Activity
Nicolas Micoud March 12, 2019 at 4:23 PM
Hello,
My 2nd patch tries to find if location is mandatory or not.
And it's ok when the panel opens.
But as you felt it, if Name and Phone are QuickEntry field and QE panel is opened from payment (where location is not mandatory), filling the Phone make the locationID field mandatory, but its label is not updated to red.
So the thing to do is to have a dynamic way to find if the location field is mandatory (that will be called when opening the panel and when filling a field of a BPLoc tab).
-> The location field may be not mandatory on opening, and became mandatory because Phone was filled
So I don't think just a change at beginning could be enough.
nb: I'm not familiar with QE panels as I'm still using a duplicated/customized version of WBPartner for BPartners (logics are too complex)
QuickEntry panels are just used for single tab window.
As we start a new client - without this complexity - i wanted to play with them
Regards,
Nicolas
Carlos Ruiz March 12, 2019 at 2:48 PM
Hi @Nicolas Micoud
> I don't see where my patch is wrong
I haven't tested but probably this will fail, enable Name and Phone as quick entry fields on BP Location tab.
In that case if you fill the phone or name - the location is mandatory, but your patch is making the location not mandatory. And I think it will try to save a null and fail there.
> And I'm sorry, I don't understand your suggestion.
> Could you elaborate more, I'm lost here
My modifications call editor.updateStyle just on fields on the first tab, and then when any field of another tab is touched, then it calls editor.updateStyle for the fields of THAT tab.
So, if the location is mandatory, calling the editor.updateStyle for location at the beginning must do the trick that you're looking for.
Regards,
Carlos Ruiz
Nicolas Micoud March 10, 2019 at 12:51 PM
Hi @Carlos Ruiz,
I don't see where my patch is wrong as it only paint the label if the parent table is not listed in the SysConfig (and that will throw an error message when validating the panel).
And I'm sorry, I don't understand your suggestion.
Could you elaborate more, I'm lost here
AFAIU, the editor.updateStyle() will only set the label in red or black, according to the mandatory property of the field.
But in Business Partner > Location tab, the BPartnerLocation.LocationID field is always mandatory thus the QE field will always be red, no ?
I think I'm missing something here :-/
Thanks,
Nicolas
Carlos Ruiz March 9, 2019 at 7:39 PM
Hi @Nicolas Micoud, I think the patch is wrong as the BPLocation field is still mandatory in the tab, but your patch is setting it as non-mandatory.
My suggestion would be to look if the same condition as the Callout is reached and just call editor.updateStyle(); for that field.
Regards,
Carlos Ruiz
Nicolas Micoud March 9, 2019 at 2:04 PM
Hi @Carlos Ruiz,
And here's the patch that paint the location label field if the caller table is not present in the BPARTNER_QUICK_ENTRY_OPTIONAL_LOCATION_TABLES
Regards,
Nicolas
Hi,
If you open the quick entry panel from an order, labels of related mandatory fields are not colored in red.
And you will raise a popup error if trying to validate the panel if those fields are not filled