# $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
+# 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 General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# 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 time import strptime
+
from report import report_sxw
import re
from lxml import etree
-from time import strptime
+
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, 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,
+ '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 :
+ if type(amount) is float:
amount = str('%.2f'%amount)
- else :
+ else:
amount = str(amount)
if (amount == '0'):
return ' '
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')
+ date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
return date_formatted
def _explode_name(self,chaine,length):
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 = []
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 found is not None and found:
if tag.get('position'):
found.append(tag)
- else :
+ else:
found.getparent().replace(found,tag)
return True