Nikolina Todorova
9 years ago
7 changed files with 171 additions and 2 deletions
-
2pdf_form_fill/__init__.py
-
3pdf_form_fill/pdf_form_fill.py
-
24pdf_form_fill_test/__init__.py
-
41pdf_form_fill_test/__openerp__.py
-
BINpdf_form_fill_test/data/pdf_form_fill_test_form.pdf
-
66pdf_form_fill_test/pdf_form_fill_test.py
-
37pdf_form_fill_test/pdf_form_fill_test_view.xml
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# Copyright (C) 2010-2014 OpenERP s.a. (<http://openerp.com>). |
|||
# Copyright (C) 2015 initOS GmbH & Co. KG (<http://www.initos.com>). |
|||
# Author Nikolina Todorova <nikolina.todorova@initos.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# 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 Affero General Public License for more details. |
|||
# |
|||
# 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 . import pdf_form_fill_test |
@ -0,0 +1,41 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# Copyright (C) 2010-2014 OpenERP s.a. (<http://openerp.com>). |
|||
# Copyright (C) 2015 initOS GmbH & Co. KG (<http://www.initos.com>). |
|||
# Author Nikolina Todorova <nikolina.todorova@initos.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# 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 Affero General Public License for more details. |
|||
# |
|||
# 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/>. |
|||
# |
|||
############################################################################## |
|||
{ |
|||
"name": "Pdf Form Fill Test", |
|||
"version": "1.0", |
|||
"depends": [ |
|||
"base", |
|||
"pdf_form_fill" |
|||
], |
|||
"author": "Nikolina Todorova - InitOS GmbH & Co. KG", |
|||
"description": """ |
|||
This module is example of the use of the pdf_form_fill module. |
|||
""", |
|||
"website": "http://www.initos.com", |
|||
"data": [ |
|||
"pdf_form_fill_test_view.xml", |
|||
], |
|||
"installable": True, |
|||
"license": "GPL-3", |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# Copyright (C) 2010-2014 OpenERP s.a. (<http://openerp.com>). |
|||
# Copyright (C) 2015 initOS GmbH & Co. KG (<http://www.initos.com>). |
|||
# Author Nikolina Todorova <nikolina.todorova@initos.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# 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 Affero General Public License for more details. |
|||
# |
|||
# 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 openerp.osv import fields, orm |
|||
import os |
|||
|
|||
|
|||
class pdf_form_fill_test(orm.Model): |
|||
_name = "pdf.form.fill.test" |
|||
_inherit = 'pdf.form.fill' |
|||
|
|||
def get_directory_name(self): |
|||
return os.path.dirname(__file__) |
|||
|
|||
def download_pdf_form(self, cr, uid, ids, field_name=None, |
|||
arg=None, context=None): |
|||
result = {} |
|||
for id in ids: |
|||
result.update(super(pdf_form_fill_test, |
|||
self).download_pdf_form(cr, uid, [id], |
|||
field_name, arg, |
|||
context=context)) |
|||
return result |
|||
|
|||
_columns = { |
|||
'first_name': fields.char('First Name'), |
|||
'last_name': fields.char('Last Name'), |
|||
'pdf_file': fields.function(download_pdf_form, method=True, |
|||
store=False, type='binary', |
|||
string="Download File"), |
|||
} |
|||
|
|||
def prepare_pdf_fields(self, cr, uid, ids, context=None): |
|||
"""Overwrite this to add specific preparations. |
|||
Return value has to be a list of tupel ('pdf field name', value) |
|||
""" |
|||
obj = self.browse(cr, uid, ids, context=context) |
|||
|
|||
return [('first_name_text', obj[0].first_name), |
|||
('last_name_text', obj[0].last_name)] |
|||
|
|||
def get_pdf_file_path(self, cr, uid, ids, context=None): |
|||
"""Overwrite this to return the specific pdf file path.""" |
|||
obj = self.browse(cr, uid, ids, context=context) |
|||
return os.path.join(os.path.join(self.get_directory_name(), |
|||
"data/pdf_form_fill_test_form.pdf")) |
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
<record model="ir.ui.view" id="pdf_form_fill_test_view_tree"> |
|||
<field name="name">pdf.form.fill.test.view.tree</field> |
|||
<field name="model">pdf.form.fill.test</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Pdf Form Fill Test Tree"> |
|||
<field name="first_name"/> |
|||
<field name="last_name"/> |
|||
<field name="pdf_file"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
<record model="ir.ui.view" id="pdf_form_fill_test_view_form"> |
|||
<field name="name">pdf.form.fill.test.view.form</field> |
|||
<field name="model">pdf.form.fill.test</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Pdf Form Fill Test Form" version="7.0"> |
|||
<field name="first_name"/> |
|||
<field name="last_name"/> |
|||
<field name="pdf_file"/> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<record model="ir.actions.act_window" id="pdf_form_fill_test_action"> |
|||
<field name="name">pdf.form.fill.test.action</field> |
|||
<field name="view_id" ref="pdf_form_fill_test_view_tree"/> |
|||
<field name="res_model">pdf.form.fill.test</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">tree,form</field> |
|||
</record> |
|||
<menuitem id="main_menu" name="Pdf Form Fill Test Main Menu"/> |
|||
<menuitem id="section_main_menu" parent="main_menu"/> |
|||
<menuitem id="action_menu" parent="section_main_menu" action="pdf_form_fill_test_action"/> |
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue