123456789101112131415161718192021222324252627282930313233 |
- # -*- coding: utf-8 -*-
- from functools import partial
- from openerp.osv import osv
- from openerp import exceptions, _
- from reportlab.graphics.barcode import createBarcodeDrawing
- class PartnerReport(osv.AbstractModel):
- _name = 'report.eiru_study_features.partner_report'
- def get_total(self, cr, uid, workorder, context=None):
- total = 0
- for line_consumed in workorder.consumed_ids:
- total += line_consumed.quantity * line_consumed.price_unit
- return total
- def render_html(self, cr, uid, ids, data=None, context=None):
- report_obj = self.pool['report']
- repair_workorder_obj = self.pool['study.feature']
- report = report_obj._get_report_from_name(
- cr, uid, 'eiru_study_features.partner_report')
- selected_orders = repair_workorder_obj.browse(
- cr, uid, ids, context=context)
- docargs = {
- 'doc_ids': ids,
- 'doc_model': report.model,
- 'docs': selected_orders,
- }
- return report_obj.render(
- cr, uid, ids, 'eiru_study_features.partner_report',
- docargs, context=context)
|