1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from openerp import api
23 from openerp.osv import osv
24 from openerp.tools.translate import _
27 class stock_picking(osv.osv):
28 _inherit = 'stock.picking'
30 @api.cr_uid_ids_context
31 def do_transfer(self, cr, uid, picking_ids, context=None):
32 """Launch Create invoice wizard if invoice state is To be Invoiced,
33 after processing the picking.
37 res = super(stock_picking, self).do_transfer(cr, uid, picking_ids, context=context)
38 pick_ids = [p.id for p in self.browse(cr, uid, picking_ids, context) if p.invoice_state == '2binvoiced']
40 context = dict(context, active_model='stock.picking', active_ids=pick_ids)
42 'name': _('Create Invoice'),
45 'res_model': 'stock.invoice.onshipping',
46 'type': 'ir.actions.act_window',
52 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: