1
1
# -*- encoding: utf-8 -*-
2
2
#################################################################################
4
# sale_extended_workflow for OpenERP #
4
# sale_picking_reservation for OpenERP #
5
5
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com> #
7
7
# This program is free software: you can redistribute it and/or modify #
26
26
class stock_picking(osv.osv):
28
28
_inherit = "stock.picking"
31
'reserved': fields.boolean('Reserved Picking', readonly=True),
35
'reserved': lambda *a: False,
30
def create(self, cr, uid, vals, context=None):
31
picking_id = super(stock_picking, self).create(cr, uid, vals, context)
32
if vals.get('sale_id', False) and self.pool.get('sale.order').search(cr, uid, [['reserved', '=', True], ['id', '=', vals['sale_id']]], context=context):
33
wf_service = netsvc.LocalService("workflow")
34
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_reserve', cr)
39
def action_reserve(self, cr, uid, ids, context=None):
43
self.write(cr, uid, ids, {'reserved' : True})
45
for picking in self.browse(cr, uid, ids, context=context):
46
for r in picking.move_lines:
47
if r.state == 'draft':
50
#self.log_picking(cr, uid, ids, context=context)
52
todo = self.action_explode(cr, uid, todo, context)
54
self.pool.get('stock.move').action_confirm(cr, uid, todo, context=context)