Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
285 Vues

Hi, I have a view where I display documents. I would like to display only documents with in_prorgess status.


<record id="view_control_document_tree" model="ir.ui.view">
<field name="name">control.document.tree</field>
<field name="model">control.document</field>
<field name="arch" type="xml">
<tree string="Control Document Structure">
<field name="code"/>
<field name="name"/>
<field name="reference"/>
<field name="partner_id"/>
<field name="reception_date"/>
<field name="deadline"/>
<field name="category"
select="True"
widget="badge"
decoration-warning=" category == 'spontanne' "
decoration-info=" category == 'fiscal' "
decoration-success=" category == 'parafiscal' "
/>
<field name="state"
select="True"
widget="badge"
decoration-danger=" state == 'cancel' "
decoration-info=" state == 'confirmed' "
decoration-warning=" state == 'in_progress' "
decoration-success=" state == 'done' "
/>
</tree>
</field>
</record>
Avatar
Ignorer
Auteur Meilleure réponse

All I want is to be shown only documents with statut is in_progress. Of course I have other statuses such as confirmed, cancel, draft, but I only want to see in_progress documents on my interface.

Avatar
Ignorer
Meilleure réponse

Hey.,

Could you explain better?

Do you want to display documents with the in_progress status, or you want to be able to choose the status and only displays those elements?

  • in the first case you should filter inside the model directly the state field.
  • in the second case you need to write a js script, that would pick up the onchange state a a selection field with the different status, and upload your model accordingly.
  • in a third case, you could render the skip the row by adding a domain to the view
 <field name="name">control.document.tree</field>
<field name="model">control.document</field>
​<field name="domain">[('state', '=', 'in_progress')]</field>
<field name="arch" type="xml">  


something like that should work.

good luck


Avatar
Ignorer