[FIX] Discount should only appear on sales order if it is checked in the settings.

bzr revid: jco@openerp.com-20130307082510-mckayx175qu9ispo
This commit is contained in:
Josse Colpaert
2013-03-07 09:25:10 +01:00
parent 0165ff819d
commit 8067436468
2 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -27,9 +27,18 @@ class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'time': time,
'show_discount':self._show_discount,
})
def _show_discount(self, uid, context=None):
cr = self.cr
try:
group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'group_discount_per_so_line')[1]
except:
return False
return group_id in [x.id for x in self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id]
report_sxw.report_sxw('report.sale.order', 'sale.order', 'addons/sale/report/sale_order.rml', parser=order, header="external")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2 -2
View File
@@ -251,7 +251,7 @@
<para style="terp_tblheader_Details_Right">Unit Price</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Disc.(%)</para>
<para style="terp_tblheader_Details_Centre">[[show_discount(user.id) and "Disc.(%)" or '']]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Price</para>
@@ -275,7 +275,7 @@
<para style="terp_default_Right_9">[[ formatLang(line.price_unit , digits=get_digits(dp='Product Price'))]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(line.discount, digits=get_digits(dp='Discount'))]]</para>
<para style="terp_default_Centre_9">[[show_discount(user.id) and formatLang(line.discount, digits=get_digits(dp='Discount')) or '']]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) ]] </para>