[REM]:account,hr_payroll:remove rml_parse.py file.

bzr revid: apa@tinyerp.com-20101026093541-0bze9bqj444gntut
This commit is contained in:
apa-tiny 2010-10-26 15:05:41 +05:30
parent ce3c513a0a
commit fe32b72179
22 changed files with 10 additions and 488 deletions

View File

@ -20,12 +20,10 @@
##############################################################################
import time
import rml_parse
from report import report_sxw
from common_report_header import common_report_header
class aged_trial_report(rml_parse.rml_parse, common_report_header):
class aged_trial_report(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context):
super(aged_trial_report, self).__init__(cr, uid, name, context=context)

View File

@ -20,7 +20,6 @@
##############################################################################
import time
from report import report_sxw
from common_report_header import common_report_header

View File

@ -22,7 +22,6 @@
import time
import locale
from report import report_sxw
import rml_parse
parents = {
'tr':1,
@ -31,7 +30,7 @@ parents = {
'section': 0
}
class account_balance_landscape(rml_parse.rml_parse):
class account_balance_landscape(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_balance_landscape, self).__init__(cr, uid, name, context=context)
self.flag=1

View File

@ -22,12 +22,11 @@
import time
import pooler
import rml_parse
from report import report_sxw
from account.report import account_profit_loss
from common_report_header import common_report_header
class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context=context)
self.obj_pl = account_profit_loss.report_pl_account_horizontal(cr, uid, name, context=context)

View File

@ -20,7 +20,6 @@
##############################################################################
import time
from report import report_sxw
from common_report_header import common_report_header
#

View File

@ -20,7 +20,6 @@
##############################################################################
import time
from common_report_header import common_report_header
from report import report_sxw

View File

@ -28,12 +28,10 @@
##############################################################################
import time
from report import report_sxw
from common_report_header import common_report_header
import rml_parse
class general_ledger(rml_parse.rml_parse, common_report_header):
class general_ledger(report_sxw.rml_parse, common_report_header):
_name = 'report.account.general.ledger'
def set_context(self, objects, data, ids, report_type=None):

View File

@ -20,7 +20,6 @@
##############################################################################
import time
from common_report_header import common_report_header
from report import report_sxw

View File

@ -22,7 +22,6 @@
import time
import re
import copy
from tools.translate import _
from report import report_sxw
from common_report_header import common_report_header

View File

@ -21,12 +21,10 @@
import time
import re
import rml_parse
from report import report_sxw
from common_report_header import common_report_header
class third_party_ledger(rml_parse.rml_parse, common_report_header):
class third_party_ledger(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
super(third_party_ledger, self).__init__(cr, uid, name, context=context)

View File

@ -20,7 +20,6 @@
##############################################################################
import time
import ir
from osv import osv
from report import report_sxw

View File

@ -19,13 +19,11 @@
##############################################################################
import time
import pooler
import rml_parse
from report import report_sxw
from common_report_header import common_report_header
class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
super(report_pl_account_horizontal, self).__init__(cr, uid, name, context=context)

View File

@ -22,7 +22,6 @@
import time
import pooler
import rml_parse
import copy
from report import report_sxw
import re
@ -46,7 +45,7 @@ def _record_to_report_line(record):
'country': _get_country(record)
}
class account_tax_code_report(rml_parse.rml_parse):
class account_tax_code_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_tax_code_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update({

View File

@ -21,12 +21,10 @@
import time
import copy
import rml_parse
from report import report_sxw
from common_report_header import common_report_header
class tax_report(rml_parse.rml_parse, common_report_header):
class tax_report(report_sxw.rml_parse, common_report_header):
_name = 'report.account.vat.declaration'
def __init__(self, cr, uid, name, context={}):
super(tax_report, self).__init__(cr, uid, name, context=context)

View File

@ -21,7 +21,6 @@
##############################################################################
import time
from report import report_sxw
from tools import amount_to_text_en

View File

@ -1,150 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# 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.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from report import report_sxw
import xml.dom.minidom
import time
import osv
import re
import pooler
import sys
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(rml_parse, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
'strip_name': self._strip_name,
'explode_name': self._explode_name,
})
def comma_me(self,amount):
#print "#" + str(amount) + "#"
if not amount:
amount = 0.0
if type(amount) is float:
amount = str('%.2f'%amount)
else:
amount = str(amount)
if (amount == '0'):
return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
return new
else:
return self.comma_me(new)
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
ellipsis = ellipsis or ''
try:
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
except Exception, e:
return False
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, '...')
def _get_and_change_date_format_for_swiss (self,date_to_format):
date_formatted=''
if date_to_format:
date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
return date_formatted
def _explode_name(self,chaine,length):
# We will test if the size is less then account
full_string = ''
if (len(str(chaine)) <= length):
return chaine
#
else:
chaine = unicode(chaine,'utf8').encode('iso-8859-1')
rup = 0
for carac in chaine:
rup = rup + 1
if rup == length:
full_string = full_string + '\n'
full_string = full_string + carac
rup = 0
else:
full_string = full_string + carac
return full_string
def makeAscii(self,str):
try:
Stringer = str.encode("utf-8")
except UnicodeDecodeError:
try:
Stringer = str.encode("utf-16")
except UnicodeDecodeError:
print "UTF_16 Error"
Stringer = str
else:
return Stringer
else:
return Stringer
return Stringer
def explode_this(self,chaine,length):
chaine = rstrip(chaine)
ast = list(chaine)
i = length
while i <= len(ast):
ast.insert(i,'\n')
i = i + length
chaine = str("".join(ast))
return chaine
def repair_string(self,chaine):
ast = list(chaine)
UnicodeAst = []
_previouslyfound = False
i = 0
while i < len(ast):
elem = ast[i]
try:
Stringer = elem.encode("utf-8")
except UnicodeDecodeError:
to_reencode = elem + ast[i+1]
print str(to_reencode)
Good_char = to_reencode.decode('utf-8')
UnicodeAst.append(Good_char)
i += i +2
else:
UnicodeAst.append(elem)
i += i + 1
return "".join(UnicodeAst)
def ReencodeAscii(self,str):
print sys.stdin.encoding
try:
Stringer = str.decode("ascii")
except UnicodeEncodeError:
print "REENCODING ERROR"
return str.encode("ascii")
except UnicodeDecodeError:
print "DECODING ERROR"
return str.encode("ascii")
else:
return Stringer

View File

@ -1,150 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# 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.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from report import report_sxw
from datetime import datetime
import re
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(rml_parse, self).__init__(cr, uid, name, context=None)
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
'strip_name': self._strip_name,
'explode_name': self._explode_name,
})
def comma_me(self, amount):
if not amount:
amount = 0.0
if type(amount) is float:
amount = str('%.2f'%amount)
else:
amount = str(amount)
if (amount == '0'):
return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
return new
else:
return self.comma_me(new)
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
ellipsis = ellipsis or ''
try:
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
except:
return False
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, '...')
def _get_and_change_date_format_for_swiss (self, date_to_format):
date_formatted = ''
if date_to_format:
date_formatted = datetime.strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
return date_formatted
def _explode_name(self, chaine, length):
# We will test if the size is less then account
full_string = ''
if (len(str(chaine)) <= length):
return chaine
#
else:
chaine = unicode(chaine,'utf8').encode('iso-8859-1')
rup = 0
for carac in chaine:
rup = rup + 1
if rup == length:
full_string = full_string + '\n'
full_string = full_string + carac
rup = 0
else:
full_string = full_string + carac
return full_string
def makeAscii(self, str):
try:
Stringer = str.encode("utf-8")
except UnicodeDecodeError:
try:
Stringer = str.encode("utf-16")
except UnicodeDecodeError:
Stringer = str
else:
return Stringer
else:
return Stringer
return Stringer
def explode_this(self, chaine, length):
chaine = rstrip(chaine)
ast = list(chaine)
i = length
while i <= len(ast):
ast.insert(i,'\n')
i = i + length
chaine = str("".join(ast))
return chaine
def repair_string(self, chaine):
ast = list(chaine)
UnicodeAst = []
_previouslyfound = False
i = 0
while i < len(ast):
elem = ast[i]
try:
Stringer = elem.encode("utf-8")
except UnicodeDecodeError:
to_reencode = elem + ast[i+1]
Good_char = to_reencode.decode('utf-8')
UnicodeAst.append(Good_char)
i += i +2
else:
UnicodeAst.append(elem)
i += i + 1
return "".join(UnicodeAst)
def ReencodeAscii(self, str):
try:
Stringer = str.decode("ascii")
except UnicodeEncodeError:
return str.encode("ascii")
except UnicodeDecodeError:
return str.encode("ascii")
else:
return Stringer
def _add_header(self, node, header=1):
if header == 2:
rml_head = self.rml_header2
else:
rml_head = self.rml_header
rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="770.0" width="1120.0" >[[company.logo]] </image> ''')
return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -28,9 +28,8 @@ import datetime
from report import report_sxw
import time
import pooler
import rml_parse
class employees_salary_report(rml_parse.rml_parse):
class employees_salary_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(employees_salary_report, self).__init__(cr, uid, name, context)

View File

@ -24,7 +24,6 @@
import time
from datetime import datetime
from report import report_sxw
from tools import amount_to_text_en

View File

@ -23,7 +23,6 @@
##############################################################################
from datetime import datetime
from report import report_sxw
from tools import amount_to_text_en

View File

@ -26,9 +26,8 @@ import datetime
from report import report_sxw
import time
import pooler
import rml_parse
class year_salary_report(rml_parse.rml_parse):
class year_salary_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(year_salary_report, self).__init__(cr, uid, name, context)

View File

@ -1,154 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $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/>.
#
##############################################################################
from time import strptime
from report import report_sxw
import re
from lxml import etree
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(rml_parse, self).__init__(cr, uid, name, context=None)
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
'strip_name' : self._strip_name,
'explode_name' : self._explode_name,
})
def comma_me(self,amount):
if not amount:
amount = 0.0
if type(amount) is float :
amount = str('%.2f'%amount)
else :
amount = str(amount)
if (amount == '0'):
return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
return new
else:
return self.comma_me(new)
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
ellipsis = ellipsis or ''
try:
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
except Exception:
return False
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, '...')
def _get_and_change_date_format_for_swiss (self,date_to_format):
date_formatted=''
if date_to_format:
date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
return date_formatted
def _explode_name(self,chaine,length):
# We will test if the size is less then account
full_string = ''
if (len(str(chaine)) <= length):
return chaine
#
else:
chaine = unicode(chaine,'utf8').encode('iso-8859-1')
rup = 0
for carac in chaine:
rup = rup + 1
if rup == length:
full_string = full_string + '\n'
full_string = full_string + carac
rup = 0
else:
full_string = full_string + carac
return full_string
def makeAscii(self,str):
try:
Stringer = str.encode("utf-8")
except UnicodeDecodeError:
try:
Stringer = str.encode("utf-16")
except UnicodeDecodeError:
print "UTF_16 Error"
Stringer = str
else:
return Stringer
else:
return Stringer
return Stringer
def explode_this(self,chaine,length):
chaine = chaine.rstrip()
ast = list(chaine)
i = length
while i <= len(ast):
ast.insert(i,'\n')
i = i + length
chaine = str("".join(ast))
return chaine
def repair_string(self,chaine):
ast = list(chaine)
UnicodeAst = []
i = 0
while i < len(ast):
elem = ast[i]
try:
Stringer = elem.encode("utf-8")
except UnicodeDecodeError:
to_reencode = elem + ast[i+1]
print str(to_reencode)
Good_char = to_reencode.decode('utf-8')
UnicodeAst.append(Good_char)
i += i +2
else:
UnicodeAst.append(elem)
i += i + 1
return "".join(UnicodeAst)
def _add_header(self, node, header='external'):
if header=='internal':
rml_head = self.rml_header2
elif header=='internal landscape':
rml_head = self.rml_header3
else:
rml_head = self.rml_header
rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="770.0" width="1120.0" >[[company.logo]] </image> ''')
rml_dom = node
head_dom = etree.XML(rml_head)
for tag in head_dom:
found = rml_dom.find('.//'+tag.tag)
if found is not None and len(found):
if tag.get('position'):
found.append(tag)
else :
found.getparent().replace(found,tag)
return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: