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 ##############################################################################
25 from osv import fields, osv
26 from tools.misc import currency
28 class color_rml(osv.osv):
30 _description = "Rml Color"
32 'name': fields.char('Name', size=64, required=True),
33 'code': fields.char('code', size=64, required=True),
38 class account_report_bs(osv.osv):
39 _name = "account.report.bs"
40 _description = "Account reporting for Balance Sheet"
43 ('Courier', 'Courier'),
44 ('Courier-Bold', 'Courier-Bold'),
45 ('Courier-BoldOblique', 'Courier-BoldOblique'),
46 ('Courier-Oblique', 'Courier-Oblique'),
47 ('Helvetica', 'Helvetica'),
48 ('Helvetica-Bold', 'Helvetica-Bold'),
49 ('Helvetica-Oblique', 'Helvetica-Oblique'),
50 ('Times-Bold', 'Times-Bold'),
51 ('Times-BoldItalic', 'Times-BoldItalic'),
52 ('Times-Italic', 'Times-Italic'),
53 ('Times-Roman', 'Times-Roman'),
63 ('lightblue', 'Light Blue'),
73 def onchange_parent_id(self, cr, uid, ids, parent_id):
76 acc = self.pool.get('account.report.report').browse(cr, uid, parent_id)
78 if int(acc.style) < 6:
79 v['style'] = str(int(acc.style) + 1)
83 'name': fields.char('Name', size=64, required=True),
84 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of account reporting for balance sheet."),
85 'code': fields.char('Code', size=64, required=True),
86 'account_id': fields.many2many('account.account', 'account_report_rel', 'report_id', 'account_id', 'Accounts'),
87 'note': fields.text('Note'),
88 'color_font': fields.many2one('color.rml', 'Font Color'),
89 'color_back': fields.many2one('color.rml', 'Back Color'),
90 'font_style': fields.selection(_font, 'Font'),
91 'parent_id': fields.many2one('account.report.bs', 'Parent'),
92 'child_id': fields.one2many('account.report.bs', 'parent_id', 'Children'),
93 '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")
96 'report_type': 'only_obj',
102 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
109 ids = self.search(cr, user, [('code', '=', name)]+ args, limit=limit, context=context)
111 ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit, context=context)
113 ids = self.search(cr, user, args, limit=limit, context=context)
114 return self.name_get(cr, user, ids, context=context)
118 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: