1
# -*- coding: utf-8 -*-
2
# __author__ = jeff@openerp.cn
3
##############################################################################
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU Affero General Public License as
7
# published by the Free Software Foundation, either version 3 of the
8
# License, or (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU Affero General Public License for more details.
15
# You should have received a copy of the GNU Affero General Public License
16
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
##############################################################################
20
from osv import fields, osv
24
class oecn_base_fonts_map(osv.osv_memory):
25
_name = 'oecn_base_fonts.map'
26
def _system_fonts_get(self, cr, uid, ids, context = None):
27
''' get fonts list on server '''
28
res = [('font1','font1'),('font2','font2')]
32
'map_id':fields.many2one('oecn_base_fonts.config','Font Map', required=True),
33
'pdf_font':fields.char('Font in pdf report', size=64, required=True),
34
'new_font':fields.selection(_system_fonts_get, 'Font to display', required=True),
39
class oecn_base_fonts_config(osv.osv_memory):
40
_name = 'oecn_base_fonts.config'
41
_inherit = 'res.config'
44
'wrap':fields.char('Word Wrap', size=64, required=True),
45
'map_ids':fields.one2many('oecn_base_fonts.map','map_id','Fonts you need to replace in pdf'),
50
def execute(self, cr, uid, ids, context=None):
51
for o in self.browse(cr, uid, ids, context=context):
52
config_obj = self.pool.get('ir.config_parameter')
55
maps = maps + [(map.pdf_font, map.new_font)]
56
config_obj.set_param(cr, uid, 'fonts_map', {'wrap':o.wrap,'maps':maps})
57
# print str(config_obj.get_param(cr, uid, 'fonts_map'))
59
oecn_base_fonts_config()
61
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: