Odoo Aide

0

0
1 Réponse
1
Jeremy Gillbert Birmanie
07/08/2019 06:47

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!

2 Commentaires
Rick Portugal
07/08/2019 07:34

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

Rick Portugal
08/08/2019 05:12

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?

Poser une question
Writer
2587
Rick
Étiquettes
Keep Informed
1 Abonné(e)s
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now