2008-11-03 19:18:56 +00:00
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
2009-05-28 05:56:33 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
2009-01-04 22:12:50 +00:00
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
2008-11-03 19:18:56 +00:00
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
2008-10-14 05:08:39 +00:00
|
|
|
import time
|
|
|
|
import pooler
|
|
|
|
import rml_parse
|
|
|
|
import copy
|
|
|
|
from report import report_sxw
|
|
|
|
import re
|
|
|
|
|
|
|
|
class account_tax_code_report(rml_parse.rml_parse):
|
2009-05-15 11:34:23 +00:00
|
|
|
#_name = 'report.account.tax.code.entries'
|
2009-05-28 05:56:33 +00:00
|
|
|
|
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
|
|
|
})
|
2009-05-28 05:56:33 +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:11:16 +00:00
|
|
|
result = []
|
|
|
|
move_line_objs = self.pool.get('account.move.line').browse(self.cr,self.uid,line_ids)
|
|
|
|
for line in move_line_objs:
|
|
|
|
res = {'date': line.date,
|
|
|
|
'ref': line.ref,
|
|
|
|
'acode': line.account_id.code,
|
|
|
|
'name': line.name,
|
|
|
|
'debit': line.debit,
|
|
|
|
'credit': line.credit,
|
|
|
|
'pname': line.partner_id and line.partner_id.name or '',
|
|
|
|
}
|
|
|
|
|
|
|
|
if line.partner_id \
|
|
|
|
and line.partner_id.address \
|
|
|
|
and line.partner_id.address[0].country_id:
|
|
|
|
res['country'] = line.partner_id.address[0].country_id.code
|
|
|
|
else:
|
|
|
|
res['country'] = ''
|
|
|
|
|
|
|
|
result.append(res)
|
|
|
|
|
2009-05-28 05:56:33 +00:00
|
|
|
return result
|
2008-10-14 05:08:39 +00:00
|
|
|
|
|
|
|
report_sxw.report_sxw('report.account.tax.code.entries', 'account.tax.code',
|
|
|
|
'addons/account/report/account_tax_code.rml', parser=account_tax_code_report, header=False)
|
|
|
|
|
2009-03-06 22:18:24 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|