openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #03787
[Merge] lp:~camptocamp/sale-reports/7.0-conditional_discount_print-rde into lp:sale-reports
Romain Deheele - Camptocamp has proposed merging lp:~camptocamp/sale-reports/7.0-conditional_discount_print-rde into lp:sale-reports.
Requested reviews:
Sale Core Editors (sale-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/sale-reports/7.0-conditional_discount_print-rde/+merge/206678
Hello,
This branch transposes conditional discount printing from official rml addons
http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/revision/8878:
when printing the sale order report, do not print the discount column if user doesn't belong to the group that enables to see it.
Regards,
Romain
--
https://code.launchpad.net/~camptocamp/sale-reports/7.0-conditional_discount_print-rde/+merge/206678
Your team Sale Core Editors is requested to review the proposed merge of lp:~camptocamp/sale-reports/7.0-conditional_discount_print-rde into lp:sale-reports.
=== modified file 'sale_order_webkit/report/sale_order.mako'
--- sale_order_webkit/report/sale_order.mako 2013-12-27 17:16:59 +0000
+++ sale_order_webkit/report/sale_order.mako 2014-02-17 10:31:49 +0000
@@ -206,7 +206,9 @@
<th class="amount main_col3">${_("UoM")}</th>
<th class="amount main_col4">${_("Unit Price")}</th>
<th class="main_col5">${_("VAT")}</th>
+ %if show_discount(user.id):
<th class="amount main_col6">${_("Disc.(%)")}</th>
+ %endif
<th class="amount main_col7">${_("Price")}</th>
</tr>
</table>
@@ -225,7 +227,9 @@
<td class="amount main_col3">${ line.product_uos and line.product_uos.name or line.product_uom.name }</td>
<td class="amount main_col4">${formatLang(line.price_unit)}</td>
<td class="main_col5">${ ', '.join([tax.description or tax.name for tax in line.tax_id]) }</td>
+ %if show_discount(user.id):
<td class="amount main_col6">${line.discount and formatLang(line.discount, digits=get_digits(dp='Sale Price')) or ''} ${line.discount and '%' or ''}</td>
+ %endif
<td class="amount main_col7">${formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</td>
</tr>
%if line.formatted_note:
=== modified file 'sale_order_webkit/report/sale_order.py'
--- sale_order_webkit/report/sale_order.py 2013-01-25 09:40:48 +0000
+++ sale_order_webkit/report/sale_order.py 2014-02-17 10:31:49 +0000
@@ -28,7 +28,17 @@
def __init__(self, cr, uid, name, context):
super(SaleOrderReport, self).__init__(cr, uid, name, context=context)
self.localcontext.update({'time': time,
- 'company_vat': self._get_company_vat})
+ 'company_vat': self._get_company_vat,
+ '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]
def _get_company_vat(self):
res_users_obj = pooler.get_pool(self.cr.dbname).get('res.users')
Follow ups