[FIX] l10n_be_intrastat: get location_id from stock move

purchase.order have been rewritten with cb01be2

It was not taken into account for intrastat  who still used the now not
existing "location_id" on purchase order.

This commit use instead the method _get_destination_location which
should be equivalent.

opw-677497
This commit is contained in:
Nicolas Lempereur
2016-05-13 17:54:21 +02:00
parent 820f7e11c1
commit 780e3fec10
+2 -2
View File
@@ -230,9 +230,9 @@ class xml_decl(osv.TransientModel):
poline_ids = POL.search(
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
purchaseorder = POL.browse(cr, uid, poline_ids, context=context).order_id
region_id = warehouse_mod.get_regionid_from_locationid(
cr, uid, purchaseorder.location_id.id, context=context)
cr, uid, purchaseorder._get_destination_location(), context=context)
if region_id:
exreg = region_mod.browse(cr, uid, region_id).code
elif inv_line.invoice_id.type in ('out_invoice', 'out_refund'):