1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
23 from openerp.osv import osv
24 from openerp.report import report_sxw
27 class report_print_check(report_sxw.rml_parse):
28 def __init__(self, cr, uid, name, context):
29 super(report_print_check, self).__init__(cr, uid, name, context)
32 self.localcontext.update({
34 'get_lines': self.get_lines,
35 'fill_stars' : self.fill_stars,
38 def fill_stars(self, amount):
40 stars = 100 - len(amount)
41 return ' '.join([amount,'*'*stars])
45 def get_lines(self, voucher_lines):
47 self.number_lines = len(voucher_lines)
48 for i in range(0, min(10,self.number_lines)):
49 if i < self.number_lines:
51 'date_due' : voucher_lines[i].date_due,
52 'name' : voucher_lines[i].name,
53 'amount_original' : voucher_lines[i].amount_original and voucher_lines[i].amount_original or False,
54 'amount_unreconciled' : voucher_lines[i].amount_unreconciled and voucher_lines[i].amount_unreconciled or False,
55 'amount' : voucher_lines[i].amount and voucher_lines[i].amount or False,
61 'amount_original' : False,
69 class report_check(osv.AbstractModel):
70 _name = 'report.account_check_writing.report_check'
71 _inherit = 'report.abstract_report'
72 _template = 'account_check_writing.report_check'
73 _wrapped_report_class = report_print_check
75 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: