parser.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. # -*- coding: utf-8 -*-
  2. from functools import partial
  3. from openerp.osv import osv
  4. from openerp import exceptions, _
  5. from reportlab.graphics.barcode import createBarcodeDrawing
  6. class PartnerReport(osv.AbstractModel):
  7. _name = 'report.eiru_study_features.partner_report'
  8. def get_total(self, cr, uid, workorder, context=None):
  9. total = 0
  10. for line_consumed in workorder.consumed_ids:
  11. total += line_consumed.quantity * line_consumed.price_unit
  12. return total
  13. def render_html(self, cr, uid, ids, data=None, context=None):
  14. report_obj = self.pool['report']
  15. repair_workorder_obj = self.pool['study.feature']
  16. report = report_obj._get_report_from_name(
  17. cr, uid, 'eiru_study_features.partner_report')
  18. selected_orders = repair_workorder_obj.browse(
  19. cr, uid, ids, context=context)
  20. docargs = {
  21. 'doc_ids': ids,
  22. 'doc_model': report.model,
  23. 'docs': selected_orders,
  24. }
  25. return report_obj.render(
  26. cr, uid, ids, 'eiru_study_features.partner_report',
  27. docargs, context=context)