[IMP] Update french translations
[odoo/odoo.git] / addons / account_reporting / account.py
1 # -*- encoding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution   
5 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6 #    $Id$
7 #
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.
12 #
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.
17 #
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/>.
20 #
21 ##############################################################################
22 import time
23 import netsvc
24 from osv import fields, osv
25
26 from tools.misc import currency
27
28 import mx.DateTime
29 from mx.DateTime import RelativeDateTime, now, DateTime, localtime
30
31
32 class color_rml(osv.osv):
33     _name = "color.rml"
34     _description = "Rml Colors"
35     _columns = {
36         'name': fields.char('Name', size=64, required=True),
37         'code': fields.char('code',size=64,required=True),
38         }
39
40 color_rml()
41
42 class account_report_bs(osv.osv):
43     _name = "account.report.bs"
44     _description = "Account reporting for Balance Sheet"
45     _font = [
46              ('',''),
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'),
58             ]
59     _color = [
60             ('', ''),
61             ('green','Green'),
62             ('red','Red'),
63             ('pink','Pink'),
64             ('blue','Blue'),
65             ('yellow','Yellow'),
66             ('cyan','Cyan'),
67             ('lightblue','Light Blue'),
68             ('orange','Orange'),
69             ]
70     _style = [
71             ('', ''),
72             ('h1','Header 1'),
73             ('h2','Header 2'),
74             ('h3','Header 3'),
75             ]
76
77     def onchange_parent_id(self, cr, uid, ids, parent_id):
78         v={}
79         if parent_id:
80             acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
81             v['type']=acc.type
82             if int(acc.style) < 6:
83                 v['style'] = str(int(acc.style)+1)
84         return {'value': v}
85
86     _columns = {
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")
99     }
100     _defaults = {
101         'report_type': lambda *a :'only_obj',
102         'color_font': lambda *a :'',
103         'color_back': lambda *a :'',
104         'font_style': lambda *a :'',
105     }
106
107     def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
108         if not args:
109             args=[]
110         if not context:
111             context={}
112         ids = []
113         if name:
114             ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit, context=context)
115             if not ids:
116                 ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
117         else:
118             ids = self.search(cr, user, args, limit=limit, context=context)
119         return self.name_get(cr, user, ids, context=context)
120
121 account_report_bs()
122
123
124 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
125