[IMP] purchase: force the company when creating an invoice from the PO, using context['force_company']
bzr revid: qdp-launchpad@openerp.com-20110707145832-xwdc0u3qhbaffehe
This commit is contained in:
parent
8c08d3841b
commit
e688cd74d0
|
@ -22,6 +22,7 @@
|
|||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import tools
|
||||
|
||||
from osv import osv, fields
|
||||
import netsvc
|
||||
|
@ -345,11 +346,17 @@ class purchase_order(osv.osv):
|
|||
self.log(cr, uid, id, message)
|
||||
return True
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, *args):
|
||||
def action_invoice_create(self, cr, uid, ids, context=None, *args):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = False
|
||||
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
for o in self.browse(cr, uid, ids):
|
||||
set_company = tools.get_and_sort_by_field(cr, uid, obj=self, ids=ids, field='company_id', context=context)
|
||||
for company_id, po_ids in set_company.items():
|
||||
ctx = context.copy()
|
||||
ctx.update({'force_company': company_id})
|
||||
for o in self.browse(cr, uid, po_ids, context=ctx):
|
||||
il = []
|
||||
todo = []
|
||||
for ol in o.order_line:
|
||||
|
|
Loading…
Reference in New Issue