~technofluid-team/openobject-addons/technofluid_multiple_installations

« back to all changes in this revision

Viewing changes to account_followup/report/report_followup_print.py

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-dedd7f8a42bd4557112a0513082691b8590ad6cc
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##############################################################################
 
2
#
 
3
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
 
4
#
 
5
# $Id: rappel.py 2514 2006-03-23 07:33:22Z pinky $
 
6
#
 
7
# WARNING: This program as such is intended to be used by professional
 
8
# programmers who take the whole responsability of assessing all potential
 
9
# consequences resulting from its eventual inadequacies and bugs
 
10
# End users who are looking for a ready-to-use solution with commercial
 
11
# garantees and support are strongly adviced to contract a Free Software
 
12
# Service Company
 
13
#
 
14
# This program is Free Software; you can redistribute it and/or
 
15
# modify it under the terms of the GNU General Public License
 
16
# as published by the Free Software Foundation; either version 2
 
17
# of the License, or (at your option) any later version.
 
18
#
 
19
# This program is distributed in the hope that it will be useful,
 
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
22
# GNU General Public License for more details.
 
23
#
 
24
# You should have received a copy of the GNU General Public License
 
25
# along with this program; if not, write to the Free Software
 
26
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
27
#
 
28
##############################################################################
 
29
import time
 
30
import ir
 
31
 
 
32
import pooler
 
33
from osv import osv
 
34
from report import report_sxw
 
35
 
 
36
class report_rappel(report_sxw.rml_parse):
 
37
        def __init__(self, cr, uid, name, context):
 
38
                super(report_rappel, self).__init__(cr, uid, name, context)
 
39
                self.localcontext.update( {
 
40
                        'time' : time,
 
41
                        'ids_to_objects': self._ids_to_objects,
 
42
                        'adr_get' : self._adr_get,
 
43
                        'getLines' : self._lines_get,
 
44
                })
 
45
 
 
46
        def _ids_to_objects(self, partners_ids):
 
47
                toto = pooler.get_pool(self.cr.dbname).get('res.partner').browse(self.cr, self.uid, partners_ids)
 
48
                return toto
 
49
 
 
50
        def _adr_get(self, partner, type):
 
51
                res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
 
52
                res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address')
 
53
                adr = res_partner.address_get(self.cr, self.uid, [partner.id], [type])[type]
 
54
                return res_partner_address.read(self.cr, self.uid, [adr])[0]
 
55
 
 
56
        def _lines_get(self, partner):
 
57
                acc = partner.property_account_receivable[0]
 
58
                moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
 
59
                movelines = moveline_obj.search(self.cr, self.uid, [('partner_id','=',partner.id), ('account_id','=',acc), ('state','=','valid')])
 
60
                movelines = moveline_obj.read(self.cr, self.uid, movelines)
 
61
                return movelines
 
62
 
 
63
report_sxw.report_sxw('report.account_followup.followup.print', 'res.partner', 'addons/account_followup/report/rappel.rml',parser=report_rappel)
 
64