2009-10-13 05:58:37 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2008-08-24 14:45:43 +00:00
|
|
|
##############################################################################
|
2010-08-19 11:51:57 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
2010-01-12 09:18:39 +00:00
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
2008-08-24 14:45:43 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2009-10-14 11:15:34 +00:00
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
2008-08-24 14:45:43 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2009-10-14 11:15:34 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2008-08-24 14:45:43 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-08-19 11:51:57 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-08-24 14:45:43 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
##############################################################################
|
2008-08-24 14:45:43 +00:00
|
|
|
|
|
|
|
import pooler
|
|
|
|
from osv.osv import osv, orm
|
|
|
|
from report.interface import report_rml
|
|
|
|
#FIXME: use the one from tools and delete the one from report
|
|
|
|
from report.int_to_text import int_to_text
|
2008-12-26 13:27:39 +00:00
|
|
|
from tools import to_xml as toxml
|
|
|
|
from tools import ustr
|
2008-08-24 14:45:43 +00:00
|
|
|
|
|
|
|
class report_custom(report_rml):
|
|
|
|
def __init__(self, name, table, tmpl, xsl):
|
|
|
|
report_rml.__init__(self, name, table, tmpl, xsl)
|
|
|
|
|
|
|
|
def create_xml(self,cr, uid, ids, datas, context={}):
|
|
|
|
pool= pooler.get_pool(cr.dbname)
|
|
|
|
lots = pool.get('auction.lots').browse(cr, uid, ids)
|
|
|
|
auction = lots[0].auction_id
|
|
|
|
|
2008-12-26 13:27:39 +00:00
|
|
|
xml = '''<?xml version="1.0" encoding="UTF-8"?>
|
2008-08-24 14:45:43 +00:00
|
|
|
<report>
|
|
|
|
<auction>
|
|
|
|
<name>%s</name>
|
|
|
|
<date-au1>%s</date-au1>
|
|
|
|
</auction>''' % (toxml(auction['name']), toxml(auction['auction1']))
|
2010-08-19 11:51:57 +00:00
|
|
|
|
2008-08-24 14:45:43 +00:00
|
|
|
i = 0
|
|
|
|
for l in lots:
|
|
|
|
if l['obj_price']==0:
|
2008-12-26 13:27:39 +00:00
|
|
|
price_french = u'retiré'
|
2008-08-24 14:45:43 +00:00
|
|
|
else:
|
|
|
|
price_french = int_to_text(int(l['obj_price'] or 0.0))+' eur'
|
|
|
|
i+=1
|
|
|
|
xml += ''' <object>
|
|
|
|
<number>%d</number>
|
|
|
|
<obj_num>%d</obj_num>
|
|
|
|
<lot_desc>%s</lot_desc>
|
|
|
|
<price>%s</price>
|
|
|
|
<obj_price>%s</obj_price>
|
2008-12-26 13:27:39 +00:00
|
|
|
</object>''' % (i, l['obj_num'], ustr(toxml(l['name'])), ustr(price_french), ustr(l['obj_price'] or '/'))
|
2008-08-24 14:45:43 +00:00
|
|
|
xml += '</report>'
|
2010-08-19 11:51:57 +00:00
|
|
|
|
2008-08-24 14:45:43 +00:00
|
|
|
return xml
|
|
|
|
|
|
|
|
report_custom('report.flagey.huissier', 'auction.lots', '', 'addons/auction/report/huissier.xsl')
|
|
|
|
|
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
|
|