[MERGE] minor improvements after integrating community localizations
bzr revid: odo@openerp.com-20101110180414-zroqvtuxps56a7q7
This commit is contained in:
@@ -56,7 +56,7 @@ class base_module_import(osv.osv_memory):
|
||||
fname = fdata.namelist()[0]
|
||||
module_name = os.path.split(fname)[0]
|
||||
|
||||
ad = tools.config['addons_path']
|
||||
ad = tools.config['addons_path'].split(",")[-1]
|
||||
|
||||
fname = os.path.join(ad, module_name+'.zip')
|
||||
try:
|
||||
|
||||
+23
-5
@@ -33,8 +33,10 @@ without flatten, one could further edit the resulting form.
|
||||
with flatten, everything is turned into text.
|
||||
"""
|
||||
|
||||
from future import with_statement
|
||||
|
||||
import os
|
||||
import netsvc,logging
|
||||
import tempfile
|
||||
|
||||
|
||||
HEAD="""%FDF-1.2
|
||||
@@ -91,14 +93,30 @@ def write_fields(out, fields):
|
||||
|
||||
def extract_keys_from_pdf(filename):
|
||||
# what about using 'pdftk filename dump_data_fields' and parsing the output ?
|
||||
os.system('pdftk %s generate_fdf output /tmp/toto.fdf' % filename)
|
||||
lines = file('/tmp/toto.fdf').readlines()
|
||||
tmp_file = tempfile.mkstemp(".fdf")[1]
|
||||
try:
|
||||
os.system('pdftk %s generate_fdf output \"%s\"' % (filename, tmp_file))
|
||||
with open(tmp_file, "r") as ofile:
|
||||
lines = ofile.readlines()
|
||||
finally:
|
||||
try:
|
||||
os.remove(tmp_file)
|
||||
except Exception:
|
||||
pass # nothing to do
|
||||
return extract_keys(lines)
|
||||
|
||||
|
||||
def fill_pdf(infile, outfile, fields):
|
||||
write_fields(file('/tmp/toto.fdf', 'w'), fields)
|
||||
os.system('pdftk %s fill_form /tmp/toto.fdf output %s flatten' % (infile, outfile))
|
||||
tmp_file = tempfile.mkstemp(".fdf")[1]
|
||||
try:
|
||||
with open(tmp_file, "w") as ofile:
|
||||
write_fields(ofile, fields)
|
||||
os.system('pdftk %s fill_form \"%s\" output %s flatten' % (infile, tmp_file, outfile))
|
||||
finally:
|
||||
try:
|
||||
os.remove(tmp_file)
|
||||
except Exception:
|
||||
pass # nothing to do
|
||||
|
||||
def testfill_pdf(infile, outfile):
|
||||
keys = extract_keys_from_pdf(infile)
|
||||
|
||||
Vendored
+1
-1
@@ -162,7 +162,7 @@ License: GPL-2+
|
||||
On Debian systems, the complete text of the GNU General Public License
|
||||
can be found in /usr/share/common-licenses/GPL-2 file.
|
||||
|
||||
Files: bin/addons/l10n_chart_uk_minimal/*
|
||||
Files: bin/addons/l10n_uk/*
|
||||
Copyright:
|
||||
(C) 2004-2008 Tiny.be <info@tiny.be>
|
||||
(C) 2004-2008 Seath Solutions Ltd.
|
||||
|
||||
@@ -21,6 +21,9 @@ for rendering workflows graphs, you need:
|
||||
* graphviz
|
||||
* pyparsing
|
||||
|
||||
For Luxembourg localization, you also need:
|
||||
* pdftk (http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/)
|
||||
|
||||
for generating reports using non .jpg images, you need:
|
||||
* Python Imaging Library for python
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ profiles = [
|
||||
'profile_manufacturing'
|
||||
]
|
||||
l10n_charts = [
|
||||
'l10n_chart_uk_minimal',
|
||||
'l10n_uk',
|
||||
False,
|
||||
'l10n_be',
|
||||
'l10n_fr'
|
||||
|
||||
Reference in New Issue
Block a user