Browse Source

Improve module description and style

pull/23/head
Nikolina Todorova 9 years ago
parent
commit
ed059c1d71
  1. 10
      pdf_form_fill/__openerp__.py
  2. 10
      pdf_form_fill/pdf_form_fill.py

10
pdf_form_fill/__openerp__.py

@ -28,6 +28,16 @@
'description': """
The user should be able to fill .pdf form by mapping the fields from a record.
The user should be able to download the filled .pdf form.
Pdf fillable form means that you can fill out the information required by
typing directly in the pdf.
That is done by creating fillable fields in the pdf document.
The idea of this module is to map openerp model fields to those fillable pdf
fields which will make possible the automatic filling the forms for all model
records. To do that you will need the .pdf fillable field names and the
corresponding model field names.
After we have the filed pdf we can use the implemented functionality
to download it.
""",
'website': 'http://www.initos.com',
'license': 'AGPL-3',

10
pdf_form_fill/pdf_form_fill.py

@ -20,8 +20,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
try:
from fdfgen import forge_fdf
except ImportError:
forge_fdf = False
from openerp.osv import orm
from fdfgen import forge_fdf
from tempfile import NamedTemporaryFile
import subprocess
import base64
@ -61,6 +64,11 @@ class pdf_form_fill(orm.Model):
fields = map(_transform_field, fields)
# create the fdf file for filling the form
if not forge_fdf:
raise orm.except_orm(
(u'Missing fdfgen library.'),
(u'You need to install python fdfgen library.')
)
fdf = forge_fdf("", fields, [], [], [])
fdf_file = NamedTemporaryFile(mode='wb', delete=False)
fdf_file.write(fdf)

Loading…
Cancel
Save