Odoo Help

Welcome!

This community 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.

1

action server multi checkbox select

By
Victor
on 12/13/13, 8:55 AM 3,289 views

Hello I'm trying to develop a ir.actions.server in a custom tree view. When I select some checkbox (the typical checkbox that it appears at first position in a tree) and I click in the button that I created, it always executes my code in the first item, not in all rows that I selected... How I can tell to OpenERP that it has to do it in all rows I selected?

This is my xml <record id="action_sale_order_liquidar" model="ir.actions.server"> <field name="name">Liquidar</field> <field name="type">ir.actions.server</field> <field name="model_id" ref="model_sale_order"/> <field name="state">code</field> <field name="code">obj.button_add_field(context=context)</field>

    </record>
    <record id="id_of_the_action_value" model="ir.values">
        <field name="name">Liquidar</field>
        <field name="action_id" ref="action_sale_order_liquidar"/>
        <field name="value" eval="'ir.actions.server,' + str(ref('action_sale_order_liquidar'))"/>
        <field name="key">action</field>
        <field name="model_id" ref="model_sale_order"/>
        <field name="model">sale.order</field>
        <field name="key2">client_action_multi</field>

    </record>

and this my py; def button_add_field(self, cursor, uid, ids, context): for i in ids:
cursor.execute("UPDATE sale_order SET estado1='complete' WHERE id = "+str(i)) return True

Thanks in advance

0
Victor
On 12/13/13, 9:34 AM

I found the problem, I have to change this line: <field name="code">obj.button_add_field(context=context)</field> to <field name="code">self.function_to_run(cr, uid, context.get('active_ids'), context=context)</field>

where function_to_run is the function which openerp will call

Hi victor, can I ask if this is for the confirmation of more than one sales order at a time?

kaynis
on 12/13/13, 9:55 AM

Were you able to open the sale order form after the function was ran? I am having this problem now where the form doesn't open after the function is ran

Eric
on 9/4/14, 3:40 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/13/13, 8:55 AM
Seen: 3289 times
Last updated: 3/29/16, 8:56 AM