sale_report.py 490 B

123456789101112131415
  1. from openerp.osv import fields, osv
  2. import openerp.addons.decimal_precision as dp
  3. class DiscountSaleReport(osv.osv):
  4. _inherit = 'sale.report'
  5. _columns = {
  6. 'discount': fields.float('Discount', readonly=True, digits=dp.get_precision('Discount')),
  7. }
  8. def _select(self):
  9. res = super(DiscountSaleReport,self)._select()
  10. select_str = res+""",sum(l.product_uom_qty * cr.rate * l.price_unit * (l.discount) / 100.0) as discount"""
  11. return select_str