Skip to Content
Menu
This question has been flagged
2 Replies
3245 Views

I want to do the following in sales order

1. I have a field in sale order lines called serial_number

2. when I save the order, it must be confirmed automatically and create the delivery of the product with the field serial_number registered in sale order line

Some idea ?

Thanks so much

Avatar
Discard
Author Best Answer

Hi Grover, I copied this code from action_button_confirm in addons/sale and obtain assertion error

do you could you tell me what is wrong ?

Thanks


class sale_order(osv.osv):

_inherit = "sale.order"

_columns = {

'coddebug':fields.integer('Codigo Debug'),

}

def create(self, cr, uid, vals, context=None):

    if not context:

        context = {}

    assert len(vals) == 1, 'This option should only be used for a single id at a time.'

    context['coddebug'] = 1

    if context.get('send_email'):

        self.force_quotation_send(cr, uid, vals, context=context)

    new_id = super(sale_order, self).create(cr, uid, vals, context=context)

    self.signal_workflow(cr, uid, vals, 'order_confirm')

    return new_id

Avatar
Discard
Best Answer

Hello Guido.

You have to override the create function, and you can send:

signal_workflow(cr, uid, [order.id], 'order_confirm')

Then you have to override the _prepare_order_line_procurement

Avatar
Discard