1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
6 # $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
8 # WARNING: This program as such is intended to be used by professional
9 # programmers who take the whole responsability of assessing all potential
10 # consequences resulting from its eventual inadequacies and bugs
11 # End users who are looking for a ready-to-use solution with commercial
12 # garantees and support are strongly adviced to contract a Free Software
15 # This program is Free Software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License
17 # as published by the Free Software Foundation; either version 2
18 # of the License, or (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 ##############################################################################
32 from osv import fields, osv
34 from tools.misc import currency
37 from mx.DateTime import RelativeDateTime, now, DateTime, localtime
40 class color_rml(osv.osv):
42 _description = "Rml Colors"
44 'name': fields.char('Name', size=64, required=True),
45 'code': fields.char('code',size=64,required=True),
50 class account_report_bs(osv.osv):
51 _name = "account.report.bs"
52 _description = "Account reporting for Balance Sheet"
55 ('Courier','Courier'),
56 ('Courier-Bold','Courier-Bold'),
57 ('Courier-BoldOblique','Courier-BoldOblique'),
58 ('Courier-Oblique','Courier-Oblique'),
59 ('Helvetica','Helvetica'),
60 ('Helvetica-Bold','Helvetica-Bold'),
61 ('Helvetica-Oblique','Helvetica-Oblique'),
62 ('Times-Bold','Times-Bold'),
63 ('Times-BoldItalic','Times-BoldItalic'),
64 ('Times-Italic','Times-Italic'),
65 ('Times-Roman','Times-Roman'),
75 ('lightblue','Light Blue'),
85 def onchange_parent_id(self, cr, uid, ids, parent_id):
88 acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
90 if int(acc.style) < 6:
91 v['style'] = str(int(acc.style)+1)
95 'name': fields.char('Name', size=64, required=True),
96 'sequence': fields.integer('Sequence'),
97 'code': fields.char('Code', size=64, required=True),
98 'account_id': fields.many2many('account.account', 'account_report_rel', 'report_id', 'account_id', 'Accounts'),
99 'note': fields.text('Note'),
100 # 'style': fields.selection(_style, 'Style'),
101 'color_font' : fields.many2one('color.rml','Font Color'),
102 'color_back' : fields.many2one('color.rml','Back Color'),
103 'font_style' : fields.selection(_font, 'Font'),
104 'parent_id': fields.many2one('account.report.bs', 'Parent'),
105 'child_id': fields.one2many('account.report.bs', 'parent_id', 'Childs'),
106 '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")
109 'report_type': lambda *a :'only_obj'
112 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
119 ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit, context=context)
121 ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
123 ids = self.search(cr, user, args, limit=limit, context=context)
124 return self.name_get(cr, user, ids, context=context)
127 ('code_uniq', 'unique (code)', 'The code of the report entry must be unique !')
133 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: