From 2d99e760c20839bc608ca0582217b851edcd0987 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Tue, 4 Oct 2016 16:51:01 +0200 Subject: [PATCH] Fix skip fusion on server when the fusion is local --- report_py3o/demo/.~lock.res_user.odt# | 1 - report_py3o/py3o_parser.py | 2 ++ report_py3o/tests/test_report_py3o.py | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 report_py3o/demo/.~lock.res_user.odt# diff --git a/report_py3o/demo/.~lock.res_user.odt# b/report_py3o/demo/.~lock.res_user.odt# deleted file mode 100644 index 3f8e53eb..00000000 --- a/report_py3o/demo/.~lock.res_user.odt# +++ /dev/null @@ -1 +0,0 @@ -,lmi,nbacsonelmi,04.10.2016 15:56,file:///home/lmi/.config/libreoffice/4; \ No newline at end of file diff --git a/report_py3o/py3o_parser.py b/report_py3o/py3o_parser.py index b3f4380d..373c7718 100644 --- a/report_py3o/py3o_parser.py +++ b/report_py3o/py3o_parser.py @@ -166,6 +166,8 @@ class Py3oParser(report_sxw): "datadict": json.dumps(datadict), "image_mapping": "{}", } + if report_xml.py3o_is_local_fusion: + fields['skipfusion'] = '1' r = requests.post( report_xml.py3o_server_id.url, data=fields, files=files) if r.status_code != 200: diff --git a/report_py3o/tests/test_report_py3o.py b/report_py3o/tests/test_report_py3o.py index c8afa04a..fb71d8e9 100644 --- a/report_py3o/tests/test_report_py3o.py +++ b/report_py3o/tests/test_report_py3o.py @@ -14,14 +14,14 @@ import openerp.tests class TestReportPy3o(TransactionCase): def test_reports(self): - domain = [('report_type', '=', 'py3o'), - ('report_name', '=', 'py3o_user_info')] - reports = self.env['ir.actions.report.xml'].search(domain) - self.assertEqual(1, len(reports)) - for r in reports: - with mock.patch('openerp.addons.report_py3o.py3o_parser.' - 'Py3oParser.create_single_pdf') as patched_pdf: - r.render_report(self.env.user.ids, - r.report_name, - {}) - self.assertEqual(1, patched_pdf.call_count) + report = self.env.ref("report_py3o.res_users_report_py3o") + with mock.patch('openerp.addons.report_py3o.py3o_parser.' + 'Py3oParser.create_single_pdf') as patched_pdf: + # test the call the the create method inside our custom parser + report.render_report(self.env.user.ids, + report.report_name, + {}) + self.assertEqual(1, patched_pdf.call_count) + res = report.render_report( + self.env.user.ids, report.report_name, {}) + self.assertTrue(res)