Set label in red when editor is mandatory and empty on quick entry panels
Description
Environment
- 09 Mar 2019, 02:02 PM
- 27 Feb 2019, 08:07 AM
relates to
Nicolas Micoud
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
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

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