[Merge] lp:openobject-addons
bzr revid: dbr@tinyerp.com-20130227100315-u8gs9tnp0d36qc5u
This commit is contained in:
@@ -7,29 +7,29 @@ msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2012-12-21 17:05+0000\n"
|
||||
"PO-Revision-Date: 2011-02-03 16:53+0000\n"
|
||||
"Last-Translator: Krisztian Eyssen <krisz@eyssen.hu>\n"
|
||||
"PO-Revision-Date: 2013-02-26 16:00+0000\n"
|
||||
"Last-Translator: krnkris <Unknown>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2012-12-22 05:51+0000\n"
|
||||
"X-Generator: Launchpad (build 16378)\n"
|
||||
"X-Launchpad-Export-Date: 2013-02-27 04:37+0000\n"
|
||||
"X-Generator: Launchpad (build 16506)\n"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: model:ir.model,name:hr_attendance.model_hr_attendance_month
|
||||
msgid "Print Monthly Attendance Report"
|
||||
msgstr ""
|
||||
msgstr "Havi jelenléti ív nyomtatása"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance:0
|
||||
msgid "Hr Attendance Search"
|
||||
msgstr ""
|
||||
msgstr "Emberi erőforrás jelenlét keresés"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: field:hr.employee,last_sign:0
|
||||
msgid "Last Sign"
|
||||
msgstr ""
|
||||
msgstr "Utoljára bejelentkezve"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance:0
|
||||
@@ -44,22 +44,27 @@ msgstr "Jelenlét"
|
||||
#, python-format
|
||||
msgid "Last sign in: %s,<br />%s.<br />Click to sign out."
|
||||
msgstr ""
|
||||
"Utoljára bejelentkezve ebbe: %s,<br />%s.<br />Kattintson kijelentkezéshez."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: constraint:hr.attendance:0
|
||||
msgid "Error ! Sign in (resp. Sign out) must follow Sign out (resp. Sign in)"
|
||||
msgstr ""
|
||||
"Hiba! Bejelentkezést (v. Kijelentkezést) egy Kijelentkezésnek (v. "
|
||||
"Bejelentkezésnek)kell követnie."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: help:hr.action.reason,name:0
|
||||
msgid "Specifies the reason for Signing In/Signing Out."
|
||||
msgstr ""
|
||||
msgstr "Meghatározza a Bejelentkezés/Kijelentkezés okát."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: report:report.hr.timesheet.attendance.error:0
|
||||
msgid ""
|
||||
"(*) A positive delay means that the employee worked less than recorded."
|
||||
msgstr ""
|
||||
"(*) Egy pozitív késleltetés azt jelenti, hogy az alkalamazott kevesebbet "
|
||||
"dolgozott mint ami rögzítve van."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance.month:0
|
||||
@@ -70,7 +75,7 @@ msgstr "Havi jelenléti ív nyomtatása"
|
||||
#: code:addons/hr_attendance/report/timesheet.py:120
|
||||
#, python-format
|
||||
msgid "Attendances by Week"
|
||||
msgstr ""
|
||||
msgstr "Hetenkénti jelenlétek"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: selection:hr.action.reason,action_type:0
|
||||
@@ -95,7 +100,7 @@ msgstr "Október"
|
||||
#. module: hr_attendance
|
||||
#: field:hr.employee,attendance_access:0
|
||||
msgid "Attendance Access"
|
||||
msgstr ""
|
||||
msgstr "Hozzáférések a jelenlétekhez"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: code:addons/hr_attendance/hr_attendance.py:154
|
||||
@@ -109,7 +114,7 @@ msgstr "Kijelentkezés"
|
||||
#: code:addons/hr_attendance/wizard/hr_attendance_error.py:49
|
||||
#, python-format
|
||||
msgid "No records are found for your selection!"
|
||||
msgstr ""
|
||||
msgstr "Nem találhatók rekordok a lekérdezéséhez!"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance.error:0
|
||||
@@ -175,12 +180,12 @@ msgstr "Figyelmeztetés"
|
||||
#. module: hr_attendance
|
||||
#: help:hr.config.settings,group_hr_attendance:0
|
||||
msgid "Allocates attendance group to all users."
|
||||
msgstr ""
|
||||
msgstr "Jelenléti csoportok hozzárendelése csoportokhoz."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance:0
|
||||
msgid "My Attendance"
|
||||
msgstr ""
|
||||
msgstr "Jelenléti ívem"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: selection:hr.attendance.month,month:0
|
||||
@@ -191,17 +196,17 @@ msgstr "Június"
|
||||
#: code:addons/hr_attendance/report/attendance_by_month.py:190
|
||||
#, python-format
|
||||
msgid "Attendances by Month"
|
||||
msgstr ""
|
||||
msgstr "Havi jelenléti ív"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: model:ir.actions.act_window,name:hr_attendance.action_hr_attendance_week
|
||||
msgid "Attendances By Week"
|
||||
msgstr ""
|
||||
msgstr "Heti jelenléti ív"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: model:ir.model,name:hr_attendance.model_hr_attendance_error
|
||||
msgid "Print Error Attendance Report"
|
||||
msgstr ""
|
||||
msgstr "Jelenléti ív napló nyomtatási hiba"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: report:report.hr.timesheet.attendance.error:0
|
||||
@@ -216,7 +221,7 @@ msgstr "Ok"
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance.error:0
|
||||
msgid "Print Attendance Report Error"
|
||||
msgstr ""
|
||||
msgstr "Jelenléti ív napló hiba nyomtatás"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: model:ir.actions.act_window,help:hr_attendance.open_view_attendance
|
||||
@@ -225,6 +230,9 @@ msgid ""
|
||||
"Sign in/Sign out actions. You can also link this feature to an attendance "
|
||||
"device using OpenERP's web service features."
|
||||
msgstr ""
|
||||
"Az idő követési funkció irányítja az alkalmazottak ki/be jelentkezés "
|
||||
"műveleteknek a kezelését. Ezt a tulajdonságot egy jelenléti készülékhez "
|
||||
"lehet rendelni az OpenERP segítségével, web szolgáltató tulajdonságokhoz."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance:0
|
||||
@@ -234,7 +242,7 @@ msgstr "Ma"
|
||||
#. module: hr_attendance
|
||||
#: report:report.hr.timesheet.attendance.error:0
|
||||
msgid "Date Signed"
|
||||
msgstr ""
|
||||
msgstr "Aláírás dátuma"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: field:hr.attendance,name:0
|
||||
@@ -244,7 +252,7 @@ msgstr "Dátum"
|
||||
#. module: hr_attendance
|
||||
#: field:hr.config.settings,group_hr_attendance:0
|
||||
msgid "Track attendances for all employees"
|
||||
msgstr ""
|
||||
msgstr "Minden alkalamzott jelenléti ívének követése"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: selection:hr.attendance.month,month:0
|
||||
@@ -255,7 +263,7 @@ msgstr "Július"
|
||||
#: model:ir.actions.act_window,name:hr_attendance.action_hr_attendance_error
|
||||
#: model:ir.actions.report.xml,name:hr_attendance.attendance_error_report
|
||||
msgid "Attendance Error Report"
|
||||
msgstr ""
|
||||
msgstr "Jelenlétek hiba lista nyomtatása"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance:0
|
||||
@@ -312,7 +320,7 @@ msgstr "Bejelentkezés"
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance.error:0
|
||||
msgid "Analysis Information"
|
||||
msgstr ""
|
||||
msgstr "Elemzési információ"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: model:ir.actions.act_window,name:hr_attendance.action_hr_attendance_month
|
||||
@@ -328,7 +336,7 @@ msgstr "Január"
|
||||
#: code:addons/hr_attendance/wizard/hr_attendance_error.py:49
|
||||
#, python-format
|
||||
msgid "No Data Available !"
|
||||
msgstr ""
|
||||
msgstr "Nem található adat!"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: selection:hr.attendance.month,month:0
|
||||
@@ -338,7 +346,7 @@ msgstr "Április"
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance.week:0
|
||||
msgid "Print Attendance Report Weekly"
|
||||
msgstr ""
|
||||
msgstr "Jelenléti ív heti nyomtatása"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: report:report.hr.timesheet.attendance.error:0
|
||||
@@ -354,7 +362,7 @@ msgstr "Művelet"
|
||||
#. module: hr_attendance
|
||||
#: model:ir.ui.menu,name:hr_attendance.menu_hr_time_tracking
|
||||
msgid "Time Tracking"
|
||||
msgstr ""
|
||||
msgstr "Idő követés"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: model:ir.actions.act_window,name:hr_attendance.open_view_attendance_reason
|
||||
@@ -370,7 +378,7 @@ msgstr "November"
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance.error:0
|
||||
msgid "Bellow this delay, the error is considered to be voluntary"
|
||||
msgstr ""
|
||||
msgstr "Itt az alábbi késleltetés, a hiba megfontolt szándékra utal"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: field:hr.attendance.error,max_delay:0
|
||||
@@ -401,19 +409,19 @@ msgstr "Heti jelenléti ív nyomtatása"
|
||||
#. module: hr_attendance
|
||||
#: model:ir.model,name:hr_attendance.model_hr_config_settings
|
||||
msgid "hr.config.settings"
|
||||
msgstr ""
|
||||
msgstr "hr.config.settings"
|
||||
|
||||
#. module: hr_attendance
|
||||
#. openerp-web
|
||||
#: code:addons/hr_attendance/static/src/js/attendance.js:36
|
||||
#, python-format
|
||||
msgid "Click to Sign In at %s."
|
||||
msgstr ""
|
||||
msgstr "Kattintson, hogy Belépjen ekkor %s."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: field:hr.action.reason,action_type:0
|
||||
msgid "Action Type"
|
||||
msgstr ""
|
||||
msgstr "Művelet típusa"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: selection:hr.attendance.month,month:0
|
||||
@@ -427,6 +435,8 @@ msgid ""
|
||||
"You tried to %s with a date anterior to another event !\n"
|
||||
"Try to contact the HR Manager to correct attendances."
|
||||
msgstr ""
|
||||
"Próbált erre %s egy korábbi dátummal egy másik eseményre !\n"
|
||||
"Vegye fel a kapcsolatot egy HE vezetővel a jelenlét kijavításához."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: selection:hr.attendance.month,month:0
|
||||
@@ -450,19 +460,21 @@ msgstr "Művelet"
|
||||
msgid ""
|
||||
"(*) A negative delay means that the employee worked more than encoded."
|
||||
msgstr ""
|
||||
"(*) Egy negatív késleltetés azt jelenti, hogy az alkalmazott többet "
|
||||
"dolgozott mint ami rögzítve lett."
|
||||
|
||||
#. module: hr_attendance
|
||||
#: view:hr.attendance.error:0
|
||||
#: view:hr.attendance.month:0
|
||||
#: view:hr.attendance.week:0
|
||||
msgid "or"
|
||||
msgstr ""
|
||||
msgstr "vagy"
|
||||
|
||||
#. module: hr_attendance
|
||||
#: help:hr.attendance,action_desc:0
|
||||
msgid ""
|
||||
"Specifies the reason for Signing In/Signing Out in case of extra hours."
|
||||
msgstr ""
|
||||
msgstr "Meghatározza az extra órákra való Belépés/Kilépés okát."
|
||||
|
||||
#~ msgid "Employees name"
|
||||
#~ msgstr "Alkalmazottak neve"
|
||||
|
||||
@@ -7,14 +7,14 @@ msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2012-12-21 17:05+0000\n"
|
||||
"PO-Revision-Date: 2011-02-03 17:24+0000\n"
|
||||
"Last-Translator: Krisztian Eyssen <krisz@eyssen.hu>\n"
|
||||
"PO-Revision-Date: 2013-02-26 15:37+0000\n"
|
||||
"Last-Translator: krnkris <Unknown>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2012-12-22 05:45+0000\n"
|
||||
"X-Generator: Launchpad (build 16378)\n"
|
||||
"X-Launchpad-Export-Date: 2013-02-27 04:37+0000\n"
|
||||
"X-Generator: Launchpad (build 16506)\n"
|
||||
|
||||
#. module: hr_contract
|
||||
#: field:hr.contract,wage:0
|
||||
@@ -24,7 +24,7 @@ msgstr "Bér"
|
||||
#. module: hr_contract
|
||||
#: view:hr.contract:0
|
||||
msgid "Information"
|
||||
msgstr ""
|
||||
msgstr "Információ"
|
||||
|
||||
#. module: hr_contract
|
||||
#: field:hr.contract,trial_date_start:0
|
||||
@@ -102,7 +102,7 @@ msgstr "Szerződéstípusok"
|
||||
#. module: hr_contract
|
||||
#: view:hr.employee:0
|
||||
msgid "Medical Exam"
|
||||
msgstr ""
|
||||
msgstr "Orvosi vizsgálat"
|
||||
|
||||
#. module: hr_contract
|
||||
#: field:hr.contract,date_end:0
|
||||
@@ -112,7 +112,7 @@ msgstr "Befejezés dátuma"
|
||||
#. module: hr_contract
|
||||
#: help:hr.contract,wage:0
|
||||
msgid "Basic Salary of the employee"
|
||||
msgstr ""
|
||||
msgstr "alklamazott alap fizetése"
|
||||
|
||||
#. module: hr_contract
|
||||
#: field:hr.contract,name:0
|
||||
@@ -133,7 +133,7 @@ msgstr "Megjegyzések"
|
||||
#. module: hr_contract
|
||||
#: field:hr.contract,permit_no:0
|
||||
msgid "Work Permit No"
|
||||
msgstr ""
|
||||
msgstr "Munkavállalási engedély száma"
|
||||
|
||||
#. module: hr_contract
|
||||
#: view:hr.contract:0
|
||||
@@ -162,7 +162,7 @@ msgstr "Munkabeosztás"
|
||||
#. module: hr_contract
|
||||
#: view:hr.contract:0
|
||||
msgid "Salary and Advantages"
|
||||
msgstr ""
|
||||
msgstr "Fizetés és juttatások"
|
||||
|
||||
#. module: hr_contract
|
||||
#: field:hr.contract,job_id:0
|
||||
@@ -173,6 +173,8 @@ msgstr "Beosztás"
|
||||
#: constraint:hr.contract:0
|
||||
msgid "Error! Contract start-date must be less than contract end-date."
|
||||
msgstr ""
|
||||
"Hiba! Szerződés induló dátuma előbb kell legyen a szerződés befejezése "
|
||||
"dátumánál."
|
||||
|
||||
#. module: hr_contract
|
||||
#: field:hr.employee,manager:0
|
||||
@@ -192,7 +194,7 @@ msgstr ""
|
||||
#. module: hr_contract
|
||||
#: field:hr.employee,vehicle_distance:0
|
||||
msgid "Home-Work Dist."
|
||||
msgstr ""
|
||||
msgstr "Lakhely és munkahely távolsága"
|
||||
|
||||
#. module: hr_contract
|
||||
#: field:hr.employee,place_of_birth:0
|
||||
@@ -202,7 +204,7 @@ msgstr "Születés helye"
|
||||
#. module: hr_contract
|
||||
#: view:hr.contract:0
|
||||
msgid "Trial Period Duration"
|
||||
msgstr ""
|
||||
msgstr "Próbaidő hossza"
|
||||
|
||||
#. module: hr_contract
|
||||
#: view:hr.contract:0
|
||||
|
||||
@@ -267,7 +267,7 @@ class project(osv.osv):
|
||||
"with Tasks (or optionally Issues if the Issue Tracker module is installed)."),
|
||||
'alias_model': fields.selection(_alias_models, "Alias Model", select=True, required=True,
|
||||
help="The kind of document created when an email is received on this project's email alias"),
|
||||
'privacy_visibility': fields.selection([('public','Public'), ('followers','Followers Only')], 'Privacy / Visibility', required=True),
|
||||
'privacy_visibility': fields.selection([('public','All Users'), ('followers','Followers Only')], 'Privacy / Visibility', required=True),
|
||||
'state': fields.selection([('template', 'Template'),('draft','New'),('open','In Progress'), ('cancelled', 'Cancelled'),('pending','Pending'),('close','Closed')], 'Status', required=True,),
|
||||
'doc_count':fields.function(_get_attached_docs, string="Number of documents attached", type='int')
|
||||
}
|
||||
|
||||
@@ -36,5 +36,6 @@ import webkit_report
|
||||
import ir_report
|
||||
import wizard
|
||||
import convert
|
||||
import report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<body style="border:0; margin: 0;" onload="subst()">
|
||||
<table class="header" style="border-bottom: 0px solid black; width: 100%">
|
||||
<tr>
|
||||
<td>${helper.embed_company_logo()|n}</td>
|
||||
<td>${helper.embed_company_logo()|safe}</td>
|
||||
<td style="text-align:right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -63,21 +63,21 @@
|
||||
<td style="text-align:right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${company.partner_id.name |entity}</td>
|
||||
<td>${company.partner_id.name}</td>
|
||||
<td/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >${company.partner_id.street or ''|entity}</td>
|
||||
<td >${company.partner_id.street or ''}</td>
|
||||
<td/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Phone: ${company.partner_id.phone or ''|entity} </td>
|
||||
<td>Phone: ${company.partner_id.phone or ''} </td>
|
||||
<td/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mail: ${company.partner_id.email or ''|entity}<br/></td>
|
||||
<td>Mail: ${company.partner_id.email or ''}<br/></td>
|
||||
</tr>
|
||||
</table> ${_debug or ''|n} </body>
|
||||
</table> ${_debug or ''|safe} </body>
|
||||
</html>]]>
|
||||
</field>
|
||||
<field eval="55.0" name="margin_top"/>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
import webkit_report_demo
|
||||
@@ -11,6 +11,7 @@
|
||||
% endfor
|
||||
</ul>
|
||||
|
||||
<p>The administrator name is: ${admin_name}</p>
|
||||
<p>If this report does not contain headers, it is because you have a badly compiled wkhtmltopdf. Consider installing
|
||||
the static version distributed on the official web site: <a href="https://code.google.com/p/wkhtmltopdf/">https://code.google.com/p/wkhtmltopdf/</a>.</p>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
from openerp.addons.report_webkit.webkit_report import webkit_report_extender
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
@webkit_report_extender("report_webkit.webkit_demo_report")
|
||||
def extend_demo(pool, cr, uid, localcontext, context):
|
||||
admin = pool.get("res.users").browse(cr, uid, SUPERUSER_ID, context)
|
||||
localcontext.update({
|
||||
"admin_name": admin.name,
|
||||
})
|
||||
@@ -38,10 +38,6 @@ import tempfile
|
||||
import time
|
||||
import logging
|
||||
|
||||
from mako.template import Template
|
||||
from mako.lookup import TemplateLookup
|
||||
from mako import exceptions
|
||||
|
||||
from openerp import netsvc
|
||||
from openerp import pooler
|
||||
from report_helper import WebKitHelper
|
||||
@@ -50,16 +46,72 @@ from openerp import addons
|
||||
from openerp import tools
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv.osv import except_osv
|
||||
from urllib import urlencode, quote as quote
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
# We use a jinja2 sandboxed environment to render mako templates.
|
||||
# Note that the rendering does not cover all the mako syntax, in particular
|
||||
# arbitrary Python statements are not accepted, and not all expressions are
|
||||
# allowed: only "public" attributes (not starting with '_') of objects may
|
||||
# be accessed.
|
||||
# This is done on purpose: it prevents incidental or malicious execution of
|
||||
# Python code that may break the security of the server.
|
||||
from jinja2.sandbox import SandboxedEnvironment
|
||||
mako_template_env = SandboxedEnvironment(
|
||||
block_start_string="<%",
|
||||
block_end_string="%>",
|
||||
variable_start_string="${",
|
||||
variable_end_string="}",
|
||||
comment_start_string="<%doc>",
|
||||
comment_end_string="</%doc>",
|
||||
line_statement_prefix="%",
|
||||
line_comment_prefix="##",
|
||||
trim_blocks=True, # do not output newline after blocks
|
||||
autoescape=True, # XML/HTML automatic escaping
|
||||
)
|
||||
mako_template_env.globals.update({
|
||||
'str': str,
|
||||
'quote': quote,
|
||||
'urlencode': urlencode,
|
||||
})
|
||||
except ImportError:
|
||||
_logger.warning("jinja2 not available, templating features will not work!")
|
||||
|
||||
def mako_template(text):
|
||||
"""Build a Mako template.
|
||||
|
||||
This template uses UTF-8 encoding
|
||||
"""
|
||||
tmp_lookup = TemplateLookup() #we need it in order to allow inclusion and inheritance
|
||||
return Template(text, input_encoding='utf-8', output_encoding='utf-8', lookup=tmp_lookup)
|
||||
|
||||
return mako_template_env.from_string(text)
|
||||
|
||||
_extender_functions = {}
|
||||
|
||||
def webkit_report_extender(report_name):
|
||||
"""
|
||||
A decorator to define functions to extend the context used in a template rendering.
|
||||
report_name must be the xml id of the desired report (it is mandatory to indicate the
|
||||
module in that xml id).
|
||||
|
||||
The given function will be called at the creation of the report. The following arguments
|
||||
will be passed to it (in this order):
|
||||
- pool The model pool.
|
||||
- cr The cursor.
|
||||
- uid The user id.
|
||||
- localcontext The context given to the template engine to render the templates for the
|
||||
current report. This is the context that should be modified.
|
||||
- context The OpenERP context.
|
||||
"""
|
||||
def fct1(fct):
|
||||
lst = _extender_functions.get(report_name)
|
||||
if not lst:
|
||||
lst = []
|
||||
_extender_functions[report_name] = lst
|
||||
lst.append(fct)
|
||||
return fct
|
||||
return fct1
|
||||
|
||||
class WebKitParser(report_sxw):
|
||||
"""Custom class that use webkit to render HTML reports
|
||||
@@ -201,6 +253,17 @@ class WebKitParser(report_sxw):
|
||||
def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None):
|
||||
"""generate the PDF"""
|
||||
|
||||
# just try to find an xml id for the report
|
||||
cr = cursor
|
||||
import openerp.pooler as pooler
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
found_xml_ids = pool.get("ir.model.data").search(cr, uid, [["model", "=", "ir.actions.report.xml"], \
|
||||
["res_id", "=", report_xml.id]], context=context)
|
||||
xml_id = None
|
||||
if found_xml_ids:
|
||||
xml_id = pool.get("ir.model.data").read(cr, uid, found_xml_ids[0], ["module", "name"])
|
||||
xml_id = "%s.%s" % (xml_id["module"], xml_id["name"])
|
||||
|
||||
if context is None:
|
||||
context={}
|
||||
htmls = []
|
||||
@@ -242,64 +305,57 @@ class WebKitParser(report_sxw):
|
||||
if not css :
|
||||
css = ''
|
||||
|
||||
#default_filters=['unicode', 'entity'] can be used to set global filter
|
||||
body_mako_tpl = mako_template(template)
|
||||
helper = WebKitHelper(cursor, uid, report_xml.id, context)
|
||||
self.parser_instance.localcontext['helper'] = helper
|
||||
self.parser_instance.localcontext['css'] = css
|
||||
self.parser_instance.localcontext['_'] = self.translate_call
|
||||
|
||||
# apply extender functions
|
||||
additional = {}
|
||||
if xml_id in _extender_functions:
|
||||
for fct in _extender_functions[xml_id]:
|
||||
fct(pool, cr, uid, self.parser_instance.localcontext, context)
|
||||
|
||||
if report_xml.precise_mode:
|
||||
for obj in objs:
|
||||
self.parser_instance.localcontext['objects'] = [obj]
|
||||
ctx = dict(self.parser_instance.localcontext)
|
||||
for obj in self.parser_instance.localcontext['objects']:
|
||||
ctx['objects'] = [obj]
|
||||
try :
|
||||
html = body_mako_tpl.render(helper=helper,
|
||||
css=css,
|
||||
_=self.translate_call,
|
||||
**self.parser_instance.localcontext)
|
||||
html = body_mako_tpl.render(dict(ctx))
|
||||
htmls.append(html)
|
||||
except Exception:
|
||||
msg = exceptions.text_error_template().render()
|
||||
except Exception, e:
|
||||
msg = u"%s" % e
|
||||
_logger.error(msg)
|
||||
raise except_osv(_('Webkit render!'), msg)
|
||||
else:
|
||||
try :
|
||||
html = body_mako_tpl.render(helper=helper,
|
||||
css=css,
|
||||
_=self.translate_call,
|
||||
**self.parser_instance.localcontext)
|
||||
html = body_mako_tpl.render(dict(self.parser_instance.localcontext))
|
||||
htmls.append(html)
|
||||
except Exception:
|
||||
msg = exceptions.text_error_template().render()
|
||||
msg = u"%s" % e
|
||||
_logger.error(msg)
|
||||
raise except_osv(_('Webkit render!'), msg)
|
||||
head_mako_tpl = mako_template(header)
|
||||
try :
|
||||
head = head_mako_tpl.render(helper=helper,
|
||||
css=css,
|
||||
_=self.translate_call,
|
||||
_debug=False,
|
||||
**self.parser_instance.localcontext)
|
||||
except Exception:
|
||||
raise except_osv(_('Webkit render!'),
|
||||
exceptions.text_error_template().render())
|
||||
head = head_mako_tpl.render(dict(self.parser_instance.localcontext, _debug=False))
|
||||
except Exception, e:
|
||||
raise except_osv(_('Webkit render!'), u"%s" % e)
|
||||
foot = False
|
||||
if footer :
|
||||
foot_mako_tpl = mako_template(footer)
|
||||
try :
|
||||
foot = foot_mako_tpl.render(helper=helper,
|
||||
css=css,
|
||||
_=self.translate_call,
|
||||
**self.parser_instance.localcontext)
|
||||
except:
|
||||
msg = exceptions.text_error_template().render()
|
||||
foot = foot_mako_tpl.render(dict({},
|
||||
**self.parser_instance.localcontext))
|
||||
except Exception, e:
|
||||
msg = u"%s" % e
|
||||
_logger.error(msg)
|
||||
raise except_osv(_('Webkit render!'), msg)
|
||||
if report_xml.webkit_debug :
|
||||
try :
|
||||
deb = head_mako_tpl.render(helper=helper,
|
||||
css=css,
|
||||
_debug=tools.ustr("\n".join(htmls)),
|
||||
_=self.translate_call,
|
||||
**self.parser_instance.localcontext)
|
||||
except Exception:
|
||||
msg = exceptions.text_error_template().render()
|
||||
deb = head_mako_tpl.render(dict(self.parser_instance.localcontext, _debug=tools.ustr("\n".join(htmls))))
|
||||
except Exception, e:
|
||||
msg = u"%s" % e
|
||||
_logger.error(msg)
|
||||
raise except_osv(_('Webkit render!'), msg)
|
||||
return (deb, 'html')
|
||||
|
||||
Reference in New Issue
Block a user