On Saturday, 8 March 2014 12:40:35 UTC+1, Albert Cervera Areny wrote: > > 2014-03-08 8:19 GMT+01:00 Emma <[email protected] <javascript:>>: > >>> > >>> I think this is the kind of things Cédric was trying to note which are > >>> going to give bug reports. You cannot safely link labels to fields > >>> automatically because Tryton allows much more complex configurations > >>> than "label - field" structure. You'll maybe end up with something > >>> that renders correctly in many cases but not in all cases, and Cédric > >>> is trying to find a solution that works always correctly. I think this > >>> is the main point here. > >> > >> > >> I don't really see what's complicated or can bring bugs in there. Two > >> fields cannot have the same name, so if two elements have the same name > >> attribute, it's a label and a widget. All widgets don't have labels in > >> front of them, there are strings, notebooks and more, but 2 form items, > one > >> next to each other, with the same name attribute are bound to be widget > and > >> label, that's how I determine what can be gathered in a same HTML > element. > >> If I'm wrong, please explain to me because I don't see any other > possible > >> case. > >>> > >>> > > > > Well... actually there one case it can be different: two consecutive > > representation on the same field with 2 different widgets (like a > treeview > > and calendar widget of an agenda) Those will usually be in different > > "sub-items" but i'll add a check to make sure this is not the case. > > The things I had in mind were something like the tax form view in the > account module (see view/tax_form.xml): > > <group col="1" id="label_amount_rate"> > <label name="amount" yfill="1" xexpand="1" yexpand="1"/> > <label name="rate" yfill="1" xexpand="1" yexpand="1"/> > </group> > <group col="1" id="amount_rate"> > <field name="amount"/> > <group col="2" id="rate"> > <field name="rate" factor="100" xexpand="0"/> > <label name="rate" string="%" xalign="0.0" xexpand="1"/> > </group> > </group> >
Well, in this very particular case (which I don't think is ever going to be looked at on a tablet or smart phone since it's part of configuration) label and field will stay 2 distinct identities (no grouping inside a single div) which means in "small mode" the label will be on top of the field instead of next to it (see screenshots lg,md,sm and xs below). This grouping is a feature, this particular form doesn't take advantage of it, it doesn't bother me, it doesn't *break* anything. <https://lh3.googleusercontent.com/-Hii7VoRwiJE/UxsFstblYFI/AAAAAAAAALs/cyNDAnk7COM/s1600/tax-form-lg.png><https://lh4.googleusercontent.com/-IVBMYrxZe-8/UxsGBPOsCjI/AAAAAAAAAL0/uOGiPVpsmSk/s1600/tax-form-md.png><https://lh4.googleusercontent.com/-B9YDVEI_q8c/UxsGlZRjINI/AAAAAAAAAL8/JfaqQfjzJcc/s1600/tax-form-sm.png><https://lh3.googleusercontent.com/-0_pH79Ac31Q/UxsG1QtOOEI/AAAAAAAAAME/P1-NsTs_VKs/s1600/tax-form-xs.png>
