← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 768255] Re: State field with invisible="True" has problem in web

 

Hello,

No need to direct commit it.
But for view your code in main branch you have to create a merge proposal
and If it will be approve by team, then it will committed to main branch.

Thanks for your understanding!....

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/768255

Title:
  State field with invisible="True" has problem in web

Status in OpenERP Web Client:
  New

Bug description:
  I want to use a button on the tree widget like this :

  
  <tree String="My One2Many Field Relation">
      <field name="name"/>
      <field name="state" invisible="True"/>
      <button name="%(my_action)d" string="Click it" states="draft,confirmed" icon="gtk-execute" type="action"/>
  </tree>

  ---

  This view is working normal on gtk-client. But it's working unproperly
  on webclient. (button named "Click it" is does not display in
  webclient. Because state field is hidden (invisible=True).

  My suggestion, edit this method like this:

  def params_from(self, data):
          id = data.get('id')
          visible = True

          if self.states:
              state = data.get('state')
              try:
                  state = ((state or False) and state.value) or 'draft'
              except:
                  # using hidden state field's value.
                  if isinstance(state, Hidden) :
                      try :
                          state = state.widget.get_value()
                      except:
                          state = ustr(state)
                  else :
                      state = ustr(state)
              visible = state in self.states

          return dict(id=id, visible=visible)

  On openerp-webclient/addons/openerp/widgets/listgrid.py line 622

  
  My I commit this code ?


References