Pedro M. Baeza
8 years ago
committed by
Pedro M. Baeza
15 changed files with 204 additions and 197 deletions
-
26report_qweb_signer/README.rst
-
1report_qweb_signer/__init__.py
-
14report_qweb_signer/__manifest__.py
-
21report_qweb_signer/demo/report_certificate.xml
-
20report_qweb_signer/demo/report_certificate_demo.xml
-
46report_qweb_signer/demo/report_partner.xml
-
45report_qweb_signer/demo/report_partner_demo.xml
-
4report_qweb_signer/i18n/es.po
-
140report_qweb_signer/models/report.py
-
2report_qweb_signer/models/report_certificate.py
-
2report_qweb_signer/models/res_company.py
-
4report_qweb_signer/tests/__init__.py
-
27report_qweb_signer/tests/test_report_qweb_signer.py
-
9report_qweb_signer/views/report_certificate_view.xml
-
20report_qweb_signer/views/res_company_view.xml
@ -1,5 +1,4 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa |
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
from . import models |
from . import models |
@ -1,21 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<!-- |
|
||||
© 2015 Antiun Ingenieria S.L. - Antonio Espinosa |
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
--> |
|
||||
<openerp> |
|
||||
<data noupdate="1"> |
|
||||
|
|
||||
<record id="demo_certificate_test" model="report.certificate"> |
|
||||
<field name="company_id" ref="base.main_company"/> |
|
||||
<field name="name">Test OCA certificate</field> |
|
||||
<field name="path">test.p12</field> |
|
||||
<field name="password_file">test.passwd</field> |
|
||||
<field name="model_id" ref="base.model_res_partner"/> |
|
||||
<field name="domain">[('customer', '=', True)]</field> |
|
||||
<field name="allow_only_one" eval="True"/> |
|
||||
<field name="attachment">'test_' + (object.name or '').replace(' ', '_').lower() + '.signed.pdf'</field> |
|
||||
</record> |
|
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- |
||||
|
Copyright 2015 Tecnativa - Antonio Espinosa |
||||
|
Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
--> |
||||
|
<odoo noupdate="1"> |
||||
|
|
||||
|
<record id="demo_certificate_test" model="report.certificate"> |
||||
|
<field name="company_id" ref="base.main_company"/> |
||||
|
<field name="name">Test OCA certificate</field> |
||||
|
<field name="path">test.p12</field> |
||||
|
<field name="password_file">test.passwd</field> |
||||
|
<field name="model_id" ref="base.model_res_partner"/> |
||||
|
<field name="domain">[('customer', '=', True)]</field> |
||||
|
<field name="allow_only_one" eval="True"/> |
||||
|
<field name="attachment">'test_' + (object.name or '').replace(' ', '_').lower() + '.signed.pdf'</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -1,46 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<!-- |
|
||||
© 2015 Antiun Ingenieria S.L. - Antonio Espinosa |
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
--> |
|
||||
<openerp> |
|
||||
<data> |
|
||||
|
|
||||
<template id="report_partner_demo_document"> |
|
||||
<t t-call="report.external_layout"> |
|
||||
<div class="page"> |
|
||||
<div class="row"> |
|
||||
<div class="col-md-12"> |
|
||||
This is a sample report for testing PDF certificates |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="row"> |
|
||||
<div class="col-md-12"> |
|
||||
<strong>Partner:</strong> <span t-field="o.name"/> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</t> |
|
||||
</template> |
|
||||
|
|
||||
<template id="report_partner_demo"> |
|
||||
<t t-call="report.html_container"> |
|
||||
<t t-foreach="doc_ids" t-as="doc_id"> |
|
||||
<t t-raw="translate_doc(doc_id, doc_model, 'lang', 'report_qweb_signer.report_partner_demo_document')"/> |
|
||||
</t> |
|
||||
</t> |
|
||||
</template> |
|
||||
|
|
||||
<report |
|
||||
id="partner_demo" |
|
||||
model="res.partner" |
|
||||
string="Test PDF certificate" |
|
||||
report_type="qweb-pdf" |
|
||||
name="report_qweb_signer.report_partner_demo" |
|
||||
file="report_qweb_signer.report_partner_demo" |
|
||||
attachment_use="True" |
|
||||
attachment="'test_' + (object.name or '').replace(' ', '_').lower() + '.pdf'" |
|
||||
/> |
|
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
@ -0,0 +1,45 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- |
||||
|
Copyright 2015 Tecnativa - Antonio Espinosa |
||||
|
Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
--> |
||||
|
<odoo> |
||||
|
|
||||
|
<template id="report_partner_demo_document"> |
||||
|
<t t-call="report.external_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<span>This is a sample report for testing PDF certificates.</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<strong>Partner:</strong> <span t-field="o.name"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<template id="report_partner_demo"> |
||||
|
<t t-call="report.html_container"> |
||||
|
<t t-foreach="docs" t-as="o"> |
||||
|
<t t-call="report_qweb_signer.report_partner_demo_document" t-lang="o.lang"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<report |
||||
|
id="partner_demo_report" |
||||
|
model="res.partner" |
||||
|
string="Test PDF certificate" |
||||
|
report_type="qweb-pdf" |
||||
|
name="report_qweb_signer.report_partner_demo" |
||||
|
file="report_qweb_signer.report_partner_demo" |
||||
|
attachment_use="True" |
||||
|
attachment="'test_' + (object.name or '').replace(' ', '_').lower() + '.pdf'" |
||||
|
/> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from . import test_report_qweb_signer |
@ -0,0 +1,27 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from openerp.tests import common |
||||
|
|
||||
|
|
||||
|
@common.at_install(False) |
||||
|
@common.post_install(True) |
||||
|
class TestReportQwebSigner(common.SavepointCase): |
||||
|
@classmethod |
||||
|
def setUpClass(cls): |
||||
|
super(TestReportQwebSigner, cls).setUpClass() |
||||
|
cls.partner = cls.env['res.partner'].create({ |
||||
|
'name': 'Test partner', |
||||
|
'customer': True, |
||||
|
}) |
||||
|
cls.report = cls.env.ref('report_qweb_signer.partner_demo_report') |
||||
|
|
||||
|
def test_report_qweb_signer(self): |
||||
|
self.env['report'].get_pdf( |
||||
|
self.partner.ids, self.report.report_name, data={}, |
||||
|
) |
||||
|
# Reprint again for taking the PDF from attachment |
||||
|
self.env['report'].get_pdf( |
||||
|
self.partner.ids, self.report.report_name, data={}, |
||||
|
) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue