Odoo Help


How to confirm many delivery orders at once? [Resolved]

on 8/28/14, 2:21 AM 1,528 views

I've wrote a custom module to enable confirming selected delivery orders in a list view.

When I use it, I don't get an error but nothing happens  to my orders.

Here's the code: delivery_order_confirm.py

class delivery_order_confirm(osv.osv_memory):
    This wizard will confirm all the selected delivery orders.

    _name = "delivery.order.confirm"
    _description = "Confirm the selected delivery orders"

    def delivery_order_confirm(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        wf_service = netsvc.LocalService('workflow')
        orders = self.pool.get('stock.picking').read(cr, uid,
                                                      ['state', 'name'],

        for record in orders:
            if not record['state'] == 'draft':
                raise orm.except_orm(_('Warning!'),
                    _("Selected delivery order cannot be confirmed because it isn't in 'Draft' state: %s."
            wf_service.trg_validate(uid, 'stock.picking', record['id'],
                                    'action_confirm', cr)
        return {'type': 'ir.actions.act_window_close'}




        <record id="delivery_order_confirm_view" model="ir.ui.view">
            <field name="name">delivery.order.confirm.form</field>
            <field name="model">delivery.order.confirm</field>
            <field name="arch" type="xml">
                <form string="Confirm selected delivery orders" version="7.0">
                    <p>Do you want to confirm selected delivery orders?</p>
                        <button string="Confirm orders" name="delivery_order_confirm" type="object" default_focus="1" class="oe_highlight"/>
                        <button string="Cancel" class="oe_link" special="cancel"/>


        <act_window id="action_delivery_order_confirm"
            key2="client_action_multi" name="Confirm orders"
            res_model="delivery.order.confirm" src_model="stock.picking"
            view_mode="form" target="new" view_type="form" />



Could you try to select a delivery which is not in Draft State, and see if the error message "WARNING" is triggered ?

Med Said BARA
on 8/28/14, 3:34 AM

Thanks for your answer Med Said, the error message is triggered, I've also added a print line inside this method to be sure that the code is being read, and it's read but not executed :o

on 8/28/14, 6:41 AM

What do you get in your openerp-server.log?

Med Said BARA
on 8/28/14, 7:47 AM

Thank you very much, it worked!

on 8/28/14, 9:44 AM

Med Said BARA

--Med Said BARA--

| 5 5 7
--Med Said BARA--
Med Said BARA
On 8/28/14, 10:09 AM

Could you try by changing 'action_confirm' to 'button_confirm'

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.


Odoo Training Center

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

Test it now

Question tools

2 follower(s)


Asked: 8/28/14, 2:21 AM
Seen: 1528 times
Last updated: 3/16/15, 8:10 AM