Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
10220 Vizualizări

Hi

I need to create a button in each tree view line like this https://i.imgur.com/3QSZKJB.png?1 with a drop down list of actions to perform like this https://i.imgur.com/DxW3N1Y.png. Is this possible, and if so how?

I already created a the button in eah line:

<button class="btn btn-secondary dropdown-toggle" type="button"/>

But the code in Bootstrap:https://getbootstrap.com/docs/4.0/components/dropdowns/#examples

<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown button
  </button>
  <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
    <a class="dropdown-item" href="#">Action</a>
    <a class="dropdown-item" href="#">Another action</a>
    <a class="dropdown-item" href="#">Something else here</a>
  </div>
</div>

doens't work in odoo12

Thanks a lot!

Imagine profil
Abandonează
Cel mai bun răspuns

In xml
<record id="action_cancel_request" model="ir.actions.server">            |
    <field name="name">Cancel</field>            
    <field name="type">ir.actions.server</field>            |
    <field name="model_id" ref="sale.model_sale_order" />            
    <field name="state">code</field>            
    <field name="binding_model_id" ref="sale.model_sale_order" />            
    <field name="code">action = self.action_cancel(cr, uid, context.get('active_ids', []),context=context</field>        
</record>

<record id="cancel_action_menu" model="ir.values">            
    <field eval="'client_action_multi'" name="key2"/>            
    <field eval="'sale.order'" name="model"/>            |
    <field name="name">Cancel</field>
     <field eval="'ir.actions.server,%d'%action_cancel_request" name="value"/>
 </record>
In python,

@api.multidef action_cancel(self):    
if self.env.context.get('active_ids', False):        
    sale_order_ids = self.browse(self.env.context.get('active_ids'))        
        for sale_order in sale_order_ids:            
            sale_order.update({'state': 'cancel'})​

Upvote my answer if I help you! Thanks!

Imagine profil
Abandonează
Autor

I did it like you said but it doesn't work.

I already added a button in each line in the external.id = pl.process_tree, now i need to have a drop-down list of actions (Copy, Share, Print, Delete..) when pressed that button

Autor

Jeremy Gillbert , i've been able to create a dropdown button in the form view, but in tree view it doens't work, i can't have <div> tags.

Do you know why and hoe to do it?

Related Posts Răspunsuri Vizualizări Activitate
1
ian. 19
4122
2
oct. 20
3894
0
aug. 19
3921
3
ian. 24
10709
2
iul. 23
784