[FIX] l10n_be_intrastat: traceback change new api

642fea4 updated some models to new API but this was not taken into
account into the part of the code this commit fix.

opw-677497
This commit is contained in:
Nicolas Lempereur
2016-05-20 10:41:27 +02:00
parent 3b234a23cb
commit 7f9942c1a4
+4 -3
View File
@@ -144,7 +144,8 @@ class xml_decl(osv.TransientModel):
invoiceline_mod = self.pool['account.invoice.line']
product_mod = self.pool['product.product']
region_mod = self.pool['l10n_be_intrastat.region']
warehouse_mod = self.pool['stock.warehouse']
warehouse_mod = self.pool['stock.warehouse'].browse(cr, uid, [], context=context)
location_mod = warehouse_mod.env['stock.location']
if dispatchmode:
mode1 = 'out_invoice'
@@ -231,8 +232,8 @@ class xml_decl(osv.TransientModel):
cr, uid, [('invoice_lines', 'in', inv_line.id)], context=context)
if poline_ids:
purchaseorder = POL.browse(cr, uid, poline_ids[0], context=context).order_id
region_id = warehouse_mod.get_regionid_from_locationid(
cr, uid, purchaseorder._get_destination_location(), context=context)
location = location_mod.browse(purchaseorder._get_destination_location())
region_id = warehouse_mod.get_regionid_from_locationid(location)
if region_id:
exreg = region_mod.browse(cr, uid, region_id).code
elif inv_line.invoice_id.type in ('out_invoice', 'out_refund'):