2009-10-14 11:15:34 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2008-11-03 19:18:56 +00:00
|
|
|
##############################################################################
|
2010-01-11 11:48:35 +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-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-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-11-03 19:18:56 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-01-11 11:48:35 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-11-03 19:18:56 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
2009-10-14 11:15:34 +00:00
|
|
|
|
2008-10-14 05:08:39 +00:00
|
|
|
import time
|
|
|
|
from report import report_sxw
|
|
|
|
|
2009-11-18 11:28:55 +00:00
|
|
|
def _get_country(record):
|
|
|
|
if record.partner_id \
|
|
|
|
and record.partner_id.address \
|
|
|
|
and record.partner_id.address[0].country_id:
|
|
|
|
return record.partner_id.address[0].country_id.code
|
|
|
|
else:
|
|
|
|
return ''
|
|
|
|
|
|
|
|
def _record_to_report_line(record):
|
|
|
|
return {'date': record.date,
|
|
|
|
'ref': record.ref,
|
|
|
|
'acode': record.account_id.code,
|
|
|
|
'name': record.name,
|
|
|
|
'debit': record.debit,
|
|
|
|
'credit': record.credit,
|
|
|
|
'pname': record.partner_id and record.partner_id.name or '',
|
|
|
|
'country': _get_country(record)
|
|
|
|
}
|
|
|
|
|
2010-10-26 09:35:41 +00:00
|
|
|
class account_tax_code_report(report_sxw.rml_parse):
|
2008-10-14 05:08:39 +00:00
|
|
|
def __init__(self, cr, uid, name, context):
|
2009-10-09 11:49:00 +00:00
|
|
|
super(account_tax_code_report, self).__init__(cr, uid, name, context=context)
|
2008-10-14 05:08:39 +00:00
|
|
|
self.localcontext.update({
|
|
|
|
'time': time,
|
2009-05-28 05:56:33 +00:00
|
|
|
'get_line':self.get_line,
|
2008-10-14 05:08:39 +00:00
|
|
|
})
|
2010-01-11 11:48:35 +00:00
|
|
|
|
2009-11-18 11:33:23 +00:00
|
|
|
def get_line(self, obj):
|
|
|
|
line_ids = self.pool.get('account.move.line').search(self.cr, self.uid, [('tax_code_id','=',obj.id)])
|
2009-11-18 11:11:16 +00:00
|
|
|
if not line_ids: return []
|
2009-05-29 11:23:59 +00:00
|
|
|
|
2009-11-18 11:28:55 +00:00
|
|
|
return map(_record_to_report_line,
|
|
|
|
self.pool.get('account.move.line')\
|
|
|
|
.browse(self.cr, self.uid, line_ids))
|
2009-05-29 11:23:59 +00:00
|
|
|
|
2008-10-14 05:08:39 +00:00
|
|
|
report_sxw.report_sxw('report.account.tax.code.entries', 'account.tax.code',
|
2010-08-24 12:37:11 +00:00
|
|
|
'addons/account/report/account_tax_code.rml', parser=account_tax_code_report, header="internal")
|
2008-10-14 05:08:39 +00:00
|
|
|
|
2009-03-06 22:18:24 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|