Fix skip fusion on server when the fusion is local

pull/744/head
Laurent Mignon 2016-10-04 16:51:01 +02:00 committed by Alexandre D. Díaz
parent 0f5bc2a8f1
commit 54a410adde
3 changed files with 13 additions and 12 deletions

View File

@ -1 +0,0 @@
,lmi,nbacsonelmi,04.10.2016 15:56,file:///home/lmi/.config/libreoffice/4;

View File

@ -166,6 +166,8 @@ class Py3oParser(report_sxw):
"datadict": json.dumps(datadict), "datadict": json.dumps(datadict),
"image_mapping": "{}", "image_mapping": "{}",
} }
if report_xml.py3o_is_local_fusion:
fields['skipfusion'] = '1'
r = requests.post( r = requests.post(
report_xml.py3o_server_id.url, data=fields, files=files) report_xml.py3o_server_id.url, data=fields, files=files)
if r.status_code != 200: if r.status_code != 200:

View File

@ -14,14 +14,14 @@ import openerp.tests
class TestReportPy3o(TransactionCase): class TestReportPy3o(TransactionCase):
def test_reports(self): def test_reports(self):
domain = [('report_type', '=', 'py3o'), report = self.env.ref("report_py3o.res_users_report_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.' with mock.patch('openerp.addons.report_py3o.py3o_parser.'
'Py3oParser.create_single_pdf') as patched_pdf: 'Py3oParser.create_single_pdf') as patched_pdf:
r.render_report(self.env.user.ids, # test the call the the create method inside our custom parser
r.report_name, report.render_report(self.env.user.ids,
report.report_name,
{}) {})
self.assertEqual(1, patched_pdf.call_count) self.assertEqual(1, patched_pdf.call_count)
res = report.render_report(
self.env.user.ids, report.report_name, {})
self.assertTrue(res)