1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ##############################################################################
24 from osv import fields, osv
26 from tools.misc import currency
29 from mx.DateTime import RelativeDateTime, now, DateTime, localtime
32 class color_rml(osv.osv):
34 _description = "Rml Colors"
36 'name': fields.char('Name', size=64, required=True),
37 'code': fields.char('code',size=64,required=True),
42 class account_report_bs(osv.osv):
43 _name = "account.report.bs"
44 _description = "Account reporting for Balance Sheet"
47 ('Courier','Courier'),
48 ('Courier-Bold','Courier-Bold'),
49 ('Courier-BoldOblique','Courier-BoldOblique'),
50 ('Courier-Oblique','Courier-Oblique'),
51 ('Helvetica','Helvetica'),
52 ('Helvetica-Bold','Helvetica-Bold'),
53 ('Helvetica-Oblique','Helvetica-Oblique'),
54 ('Times-Bold','Times-Bold'),
55 ('Times-BoldItalic','Times-BoldItalic'),
56 ('Times-Italic','Times-Italic'),
57 ('Times-Roman','Times-Roman'),
67 ('lightblue','Light Blue'),
77 def onchange_parent_id(self, cr, uid, ids, parent_id):
80 acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
82 if int(acc.style) < 6:
83 v['style'] = str(int(acc.style)+1)
87 'name': fields.char('Name', size=64, required=True),
88 'sequence': fields.integer('Sequence'),
89 'code': fields.char('Code', size=64, required=True),
90 'account_id': fields.many2many('account.account', 'account_report_rel', 'report_id', 'account_id', 'Accounts'),
91 'note': fields.text('Note'),
92 # 'style': fields.selection(_style, 'Style'),
93 'color_font' : fields.many2one('color.rml','Font Color'),
94 'color_back' : fields.many2one('color.rml','Back Color'),
95 'font_style' : fields.selection(_font, 'Font'),
96 'parent_id': fields.many2one('account.report.bs', 'Parent'),
97 'child_id': fields.one2many('account.report.bs', 'parent_id', 'Children'),
98 'report_type' : fields.selection([('only_obj', 'Report Objects Only'),('with_account', 'Report Objects With Accounts'),('acc_with_child', 'Report Objects With Accounts and child of Accounts')],"Report Type")
101 'report_type': lambda *a :'only_obj',
102 'color_font': lambda *a :'',
103 'color_back': lambda *a :'',
104 'font_style': lambda *a :'',
107 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
114 ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit, context=context)
116 ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
118 ids = self.search(cr, user, args, limit=limit, context=context)
119 return self.name_get(cr, user, ids, context=context)
124 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: