Tryton - Issues

 

Issue1367

Title <label> does not honor 'states'
Priority feature Status resolved
Superseder Nosy List ced, htgoebel
Type Components tryton
Assigned To ced Keywords 1.4.0
Reviews

Created on 2010-01-08.18:16:38 by htgoebel, last changed by ced.

Messages
msg5496 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-01-11.12:35:36
Fix with changeset aeddd0e04b60
msg5476 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-01-08.19:42:22
Patch updated to fix msg5468
msg5475 (view) Author: [hidden] (htgoebel) Date: 2010-01-08.19:32:25
For msg5468 states are defined in the model (see below). When using the xml as in msg5468, the field is invisible, but the label is displayed.

# requires party_type
STATES_PERSON = {
    "readonly": "active == False or party_type != 'person'",
    "invisible": "party_type != 'person'",
}

class Party(ModelSQL, ModelView):
    _name = 'party.party'
    works_for = fields.Many2Many('party-worksfor-party',
                                  'person','org',
                                 'Works for',
                                 domain=["('party_type','=','organization')"],
                                 states=STATES_PERSON
                                 )
Party()
msg5473 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-01-08.19:23:47
I don't understand msg5468, there is no states in the xml.
What is the current behavior and what is expected?
msg5472 (view) Author: [hidden] (htgoebel) Date: 2010-01-08.19:17:01
Re msg5469: would this solve the problem described in msg5468? (Or is the an error in msg5468?)
msg5471 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-01-08.19:14:24
http://codereview.appspot.com/183162
msg5469 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-01-08.19:02:18
Maybe we should do not override states of label linked to field if there is a states attribute in the xml.
msg5468 (view) Author: [hidden] (htgoebel) Date: 2010-01-08.18:55:01
In this case, this link does not work:

		<label name="works_for" string="Works for" align="0.0"/>
		<field name="works_for">
		  <tree string="Works for">
		     <field name="name"/>
		     <field name="party_type"/>
		  </tree>
		</field>
msg5467 (view) Author: [hidden] (htgoebel) Date: 2010-01-08.18:49:00
I'll prepare a patch for the docs.
msg5466 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-01-08.18:20:21
When label is linked to a field, it uses the field states.
msg5465 (view) Author: [hidden] (htgoebel) Date: 2010-01-08.18:16:38
Defining a label like this still renders it:
<label name="workers" states="{'invisible': '1'}" />
History
Date User Action Args
2010-01-11 12:35:36cedsetstatus: in-progress -> resolved
messages: + msg5496
2010-01-08 19:42:22cedsetmessages: + msg5476
2010-01-08 19:32:25htgoebelsetmessages: + msg5475
2010-01-08 19:23:47cedsetmessages: + msg5473
2010-01-08 19:17:01htgoebelsetmessages: + msg5472
2010-01-08 19:14:24cedsetmessages: + msg5471
2010-01-08 19:14:17cedsetpriority: bug -> feature
2010-01-08 19:02:18cedsetstatus: chatting -> in-progress
messages: + msg5469
2010-01-08 18:55:01htgoebelsetstatus: invalid -> chatting
messages: + msg5468
2010-01-08 18:49:00htgoebelsetmessages: + msg5467

Showing 10 items. Show all history (warning: this could be VERY long)