PURCHASE: use partner code for report order

bzr revid: ced-90d467554b2866e292fdbeacd82c37055c901744
This commit is contained in:
ced 2007-01-15 08:17:23 +00:00
parent 0483eaec06
commit 58dfc0c069
3 changed files with 5 additions and 2 deletions

View File

@ -269,7 +269,6 @@ class product_product(osv.osv):
product = self.browse(cr, uid, [product_id], context)[0]
for supinfo in product.seller_ids:
if supinfo.name.id == partner_id:
print {'code': supinfo.product_code, 'name': supinfo.product_name}
return {'code': supinfo.product_code, 'name': supinfo.product_name}
return {'code' : product.default_code, 'name' : product.name}

View File

@ -38,6 +38,7 @@ class order(report_sxw.rml_parse):
'time': time,
'get_line_tax': self._get_line_tax,
'get_tax': self._get_tax,
'get_product_code': self._get_product_code,
})
def _get_line_tax(self, line_obj):
self.cr.execute("SELECT tax_id FROM purchase_order_taxe WHERE order_line_id=%d" % (line_obj.id))
@ -79,5 +80,8 @@ class order(report_sxw.rml_parse):
'base':base,
'amount':base*tax.amount})
return res
def _get_product_code(self, product_id, partner_id):
product_obj=pooler.get_pool(self.cr.dbname).get('product.product')
return product_obj._product_code(self.cr, self.uid, [product_id], name=None, arg=None, context={'partner_id': partner_id})[product_id]
report_sxw.report_sxw('report.purchase.order','purchase.order','addons/purchase/report/order.rml',parser=order)

View File

@ -186,7 +186,7 @@
<blockTable colWidths="194.0,65.0,52.0,65.0,64.0,69.0" style="Tableau3">
<tr>
<td>
<para style="P16">[[ line.product_id and line.product_id.default_code or '' ]]</para>
<para style="P16">[[ line.product_id and get_product_code(line.product_id.id, o.partner_id.id) or '' ]]</para>
<para style="P16">[[ line.name ]]</para>
</td>
<td>