[IMP/ADD]: Header in hr_attendance xsl report - 'Attendance By Month' with saperate header template for xsl landscape rport. Add FormatLang in header's date of hr reports.
bzr revid: rch_open_erp-20100914132035-ny793gedcmah1pem
This commit is contained in:
parent
d6486e17d2
commit
252cb55691
|
@ -29,6 +29,8 @@ import pooler
|
||||||
from report.interface import report_rml
|
from report.interface import report_rml
|
||||||
from report.interface import toxml
|
from report.interface import toxml
|
||||||
|
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
one_day = DateTime.RelativeDateTime(days=1)
|
one_day = DateTime.RelativeDateTime(days=1)
|
||||||
month2name = [0, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
month2name = [0, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||||
|
|
||||||
|
@ -85,11 +87,22 @@ class report_custom(report_rml):
|
||||||
days_xml.append(today_xml)
|
days_xml.append(today_xml)
|
||||||
today, tomor = tomor, tomor + one_day
|
today, tomor = tomor, tomor + one_day
|
||||||
user_xml.append(user_repr % '\n'.join(days_xml))
|
user_xml.append(user_repr % '\n'.join(days_xml))
|
||||||
|
|
||||||
|
rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||||
|
rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
|
||||||
|
header_xml = '''
|
||||||
|
<header>
|
||||||
|
<date>%s</date>
|
||||||
|
<company>%s</company>
|
||||||
|
</header>
|
||||||
|
''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
|
||||||
|
|
||||||
xml = '''<?xml version="1.0" encoding="UTF-8" ?>
|
xml = '''<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<report>
|
<report>
|
||||||
%s
|
%s
|
||||||
|
%s
|
||||||
</report>
|
</report>
|
||||||
''' % '\n'.join(user_xml)
|
''' % (header_xml,'\n'.join(user_xml))
|
||||||
return xml
|
return xml
|
||||||
|
|
||||||
report_custom('report.hr.attendance.bymonth', 'hr.employee', '', 'addons/hr_attendance/report/bymonth.xsl')
|
report_custom('report.hr.attendance.bymonth', 'hr.employee', '', 'addons/hr_attendance/report/bymonth.xsl')
|
||||||
|
|
|
@ -3,23 +3,15 @@
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||||
|
|
||||||
|
<xsl:import href="hr_custom_default.xsl"/>
|
||||||
|
<xsl:import href="hr_custom_rml.xsl"/>
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<xsl:call-template name="rml" />
|
<xsl:call-template name="rml" />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<xsl:template name="rml">
|
<xsl:template name="stylesheet">
|
||||||
<document filename="example.pdf">
|
|
||||||
<template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Attendance By Month" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
|
|
||||||
<pageTemplate id="first">
|
|
||||||
<pageGraphics>
|
|
||||||
<drawRightString x="19.0cm" y="26.0cm"><xsl:value-of select="date"/></drawRightString>
|
|
||||||
</pageGraphics>
|
|
||||||
<frame id="col1" x1="2.0cm" y1="2.5cm" width="22.7cm" height="18cm"/>
|
|
||||||
</pageTemplate>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<stylesheet>
|
|
||||||
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
|
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||||
<paraStyle name="name" fontName="Helvetica" textColor="green" fontSize="7"/>
|
<paraStyle name="name" fontName="Helvetica" textColor="green" fontSize="7"/>
|
||||||
<paraStyle name="normal" fontName="Helvetica" fontSize="6"/>
|
<paraStyle name="normal" fontName="Helvetica" fontSize="6"/>
|
||||||
|
@ -33,15 +25,10 @@
|
||||||
<lineStyle kind="LINEBELOW" colorName="grey" start="0,0" stop="-1,-1"/>
|
<lineStyle kind="LINEBELOW" colorName="grey" start="0,0" stop="-1,-1"/>
|
||||||
<blockValign value="TOP"/>
|
<blockValign value="TOP"/>
|
||||||
</blockTableStyle>
|
</blockTableStyle>
|
||||||
</stylesheet>
|
</xsl:template>
|
||||||
|
|
||||||
<story>
|
|
||||||
<xsl:call-template name="story"/>
|
|
||||||
</story>
|
|
||||||
</document>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="story">
|
<xsl:template name="story">
|
||||||
|
<spacer length="1cm" />
|
||||||
<para style="terp_header_Centre" t="1">Attendance By Month</para>
|
<para style="terp_header_Centre" t="1">Attendance By Month</para>
|
||||||
<spacer length="1cm" />
|
<spacer length="1cm" />
|
||||||
<blockTable
|
<blockTable
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version = '1.0' encoding="utf-8"?>
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||||
|
<xsl:template name="first_page_graphics_corporation">
|
||||||
|
<!--logo-->
|
||||||
|
<fill color="black"/>
|
||||||
|
<stroke color="black"/>
|
||||||
|
<setFont name="DejaVu Sans" size="8"/>
|
||||||
|
<drawString x="1.3cm" y="19.5cm"><xsl:value-of select="//report/header/date"/></drawString>
|
||||||
|
<setFont name="DejaVu Sans Bold" size="10"/>
|
||||||
|
<drawString x="13.8cm" y="19.5cm"><xsl:value-of select="//report/header/company"/></drawString>
|
||||||
|
<setFont name="DejaVu Sans" size="8"/>
|
||||||
|
<drawRightString x="28.4cm" y="19.5cm"><pageNumber/> / </drawRightString>
|
||||||
|
<stroke color="#000000"/>
|
||||||
|
<lines>1.3cm 19.3cm 28.5cm 19.3cm</lines>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="other_pages_graphics_corporation">
|
||||||
|
<!--logo-->
|
||||||
|
<fill color="black"/>
|
||||||
|
<stroke color="black"/>
|
||||||
|
<setFont name="DejaVu Sans" size="8"/>
|
||||||
|
<drawString x="1.3cm" y="19.5cm"><xsl:value-of select="//report/header/date"/></drawString>
|
||||||
|
<setFont name="DejaVu Sans Bold" size="10"/>
|
||||||
|
<drawString x="27.8cm" y="19.5cm"><xsl:value-of select="//report/header/company"/></drawString>
|
||||||
|
<setFont name="DejaVu Sans" size="8"/>
|
||||||
|
<drawRightString x="28.4cm" y="19.5cm"><pageNumber/> / </drawRightString>
|
||||||
|
<stroke color="#000000"/>
|
||||||
|
<lines>1.3cm 19.3cm 28.5cm 19.3cm</lines>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="first_page_frames">
|
||||||
|
<frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="other_pages_frames">
|
||||||
|
<frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version = '1.0' encoding="utf-8"?>
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||||
|
|
||||||
|
<xsl:template name="first_page_graphics_report"/>
|
||||||
|
<xsl:template name="other_pages_graphics_report"/>
|
||||||
|
|
||||||
|
<xsl:template name="rml">
|
||||||
|
<document filename="example.pdf">
|
||||||
|
<template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Timesheets" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
|
||||||
|
<pageTemplate id="first_page">
|
||||||
|
<pageGraphics>
|
||||||
|
<xsl:call-template name="first_page_graphics_corporation"/>
|
||||||
|
</pageGraphics>
|
||||||
|
|
||||||
|
<xsl:call-template name="first_page_frames"/>
|
||||||
|
</pageTemplate>
|
||||||
|
<pageTemplate id="other_pages">
|
||||||
|
<pageGraphics>
|
||||||
|
<xsl:call-template name="other_pages_graphics_corporation"/>
|
||||||
|
</pageGraphics>
|
||||||
|
|
||||||
|
<xsl:call-template name="other_pages_frames"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<stylesheet>
|
||||||
|
<xsl:call-template name="stylesheet"/>
|
||||||
|
</stylesheet>
|
||||||
|
|
||||||
|
<story>
|
||||||
|
<xsl:call-template name="story"/>
|
||||||
|
</story>
|
||||||
|
|
||||||
|
</document>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -28,6 +28,7 @@ from report.interface import toxml
|
||||||
|
|
||||||
import pooler
|
import pooler
|
||||||
import time
|
import time
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
def lengthmonth(year, month):
|
def lengthmonth(year, month):
|
||||||
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
|
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
|
||||||
|
@ -235,12 +236,14 @@ class report_custom(report_rml):
|
||||||
emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom)
|
emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom)
|
||||||
row_id = row_id +1
|
row_id = row_id +1
|
||||||
|
|
||||||
|
rpt_obj = pooler.get_pool(cr.dbname).get('hr.holidays')
|
||||||
|
rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
|
||||||
header_xml = '''
|
header_xml = '''
|
||||||
<header>
|
<header>
|
||||||
<date>%s</date>
|
<date>%s</date>
|
||||||
<company>%s</company>
|
<company>%s</company>
|
||||||
</header>
|
</header>
|
||||||
''' % (time.strftime('%m/%d/%Y %H:%M'),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
|
''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
|
||||||
|
|
||||||
# Computing the xml
|
# Computing the xml
|
||||||
xml='''<?xml version="1.0" encoding="UTF-8" ?>
|
xml='''<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
|
@ -26,6 +26,7 @@ from report.interface import toxml
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
import time
|
import time
|
||||||
import pooler
|
import pooler
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
def lengthmonth(year, month):
|
def lengthmonth(year, month):
|
||||||
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
|
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
|
||||||
|
@ -76,12 +77,14 @@ class report_custom(report_rml):
|
||||||
<amount>%.2f</amount>
|
<amount>%.2f</amount>
|
||||||
</time-element>
|
</time-element>
|
||||||
'''
|
'''
|
||||||
|
rpt_obj = pooler.get_pool(cr.dbname).get('hr.holidays')
|
||||||
|
rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
|
||||||
header_xml = '''
|
header_xml = '''
|
||||||
<header>
|
<header>
|
||||||
<date>%s</date>
|
<date>%s</date>
|
||||||
<company>%s</company>
|
<company>%s</company>
|
||||||
</header>
|
</header>
|
||||||
''' % (time.strftime('%m/%d/%Y %H:%M'),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
|
''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
|
||||||
|
|
||||||
account_xml = []
|
account_xml = []
|
||||||
for account, telems in accounts.iteritems():
|
for account, telems in accounts.iteritems():
|
||||||
|
|
|
@ -25,6 +25,7 @@ from report.interface import toxml
|
||||||
import time
|
import time
|
||||||
import pooler
|
import pooler
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
|
|
||||||
def lengthmonth(year, month):
|
def lengthmonth(year, month):
|
||||||
|
@ -96,13 +97,14 @@ class report_custom(report_rml):
|
||||||
# Computing the xml
|
# Computing the xml
|
||||||
#Without this, report don't show non-ascii characters (TO CHECK)
|
#Without this, report don't show non-ascii characters (TO CHECK)
|
||||||
date_xml = '\n'.join(date_xml)
|
date_xml = '\n'.join(date_xml)
|
||||||
|
rpt_obj = pooler.get_pool(cr.dbname).get('hr.holidays')
|
||||||
|
rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
|
||||||
header_xml = '''
|
header_xml = '''
|
||||||
<header>
|
<header>
|
||||||
<date>%s</date>
|
<date>%s</date>
|
||||||
<company>%s</company>
|
<company>%s</company>
|
||||||
</header>
|
</header>
|
||||||
''' % (time.strftime('%m/%d/%Y %H:%M'),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
|
''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
|
||||||
|
|
||||||
xml='''<?xml version="1.0" encoding="UTF-8" ?>
|
xml='''<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<report>
|
<report>
|
||||||
|
|
Loading…
Reference in New Issue