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 osv import fields, osv
25 from tools.misc import currency
28 from mx.DateTime import RelativeDateTime, now, DateTime, localtime
31 class color_rml(osv.osv):
33 _description = "Rml Colors"
35 'name': fields.char('Name', size=64, required=True),
36 'code': fields.char('code',size=64,required=True),
41 class account_report_bs(osv.osv):
42 _name = "account.report.bs"
43 _description = "Account reporting for Balance Sheet"
46 ('Courier','Courier'),
47 ('Courier-Bold','Courier-Bold'),
48 ('Courier-BoldOblique','Courier-BoldOblique'),
49 ('Courier-Oblique','Courier-Oblique'),
50 ('Helvetica','Helvetica'),
51 ('Helvetica-Bold','Helvetica-Bold'),
52 ('Helvetica-Oblique','Helvetica-Oblique'),
53 ('Times-Bold','Times-Bold'),
54 ('Times-BoldItalic','Times-BoldItalic'),
55 ('Times-Italic','Times-Italic'),
56 ('Times-Roman','Times-Roman'),
66 ('lightblue','Light Blue'),
76 def onchange_parent_id(self, cr, uid, ids, parent_id):
79 acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
81 if int(acc.style) < 6:
82 v['style'] = str(int(acc.style)+1)
86 'name': fields.char('Name', size=64, required=True),
87 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of account reporting for balance sheet."),
88 'code': fields.char('Code', size=64, required=True),
89 'account_id': fields.many2many('account.account', 'account_report_rel', 'report_id', 'account_id', 'Accounts'),
90 'note': fields.text('Note'),
91 # 'style': fields.selection(_style, 'Style'),
92 'color_font' : fields.many2one('color.rml','Font Color'),
93 'color_back' : fields.many2one('color.rml','Back Color'),
94 'font_style' : fields.selection(_font, 'Font'),
95 'parent_id': fields.many2one('account.report.bs', 'Parent'),
96 'child_id': fields.one2many('account.report.bs', 'parent_id', 'Children'),
97 '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")
100 'report_type': lambda *a :'only_obj',
101 'color_font': lambda *a :'',
102 'color_back': lambda *a :'',
103 'font_style': lambda *a :'',
106 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
113 ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit, context=context)
115 ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
117 ids = self.search(cr, user, args, limit=limit, context=context)
118 return self.name_get(cr, user, ids, context=context)
123 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: