--- /home/quentin/Developpement/OpenERP_official/6.0.RC1/openerp-server-6.0.0-rc1/bin/addons/stock/wizard/stock_invoice_onshipping.py 2010-10-18 22:55:47.000000000 +0200 +++ /home/quentin/Developpement/OpenERP_official/MSF_6.0/openerp-server-6.0.0-rc1/bin/addons/stock/wizard/stock_invoice_onshipping.py 2010-11-18 16:24:34.000000000 +0100 @@ -63,6 +63,8 @@ pick_type = 'in_invoice' elif pick.type == 'in' and src_usage == 'customer': pick_type = 'out_refund' + elif pick.type == 'out': + pick_type = 'in_invoice' else: pick_type = 'out_invoice' return pick_type @@ -80,6 +82,13 @@ context['date_inv'] = onshipdata_obj['invoice_date'] invoice_ids = [] for picking in picking_obj.browse(cr, uid, context.get('active_ids', []), context=context): + if not context.get('type', False): + context['type'] = self._get_type(picking) + if context.get('type', 'out_invoice') == 'in_invoice' or context.get('type', 'out_invoice') == 'out_refund': + context['journal_type'] = 'purchase' + else: + context['journal_type'] = 'sale' + if picking.invoice_state == '2binvoiced': res = picking_obj.action_invoice_create(cr, uid, [picking.id], journal_id = onshipdata_obj['journal_id'], @@ -90,7 +99,7 @@ if not invoice_ids: raise osv.except_osv(_('Error'), _('No invoice were created')) - + return { 'domain': "[('id','in', ["+','.join(map(str,invoice_ids))+"])]", 'name' : _('New picking invoices'),