[FIX] base_report_designer: fix upload code in plugin to avoid broken reports
It is the call to upload_report() that triggers the registration of the new reports in the system, as report services. Unfortunately the `header` property of the report is cached in the report service and taken from its value at registration time. So that value *must* be written before calling upload_report(). Also force the `Corporate Header` to be checked by default as this is what users want in most cases, and forgetting it at report creation makes it very hard to set afterwards, as it is cached in the service. Updated plugin binary as well. bzr revid: odo@openerp.com-20130304173125-zky8rtdye64bep07
This commit is contained in:
parent
018416630d
commit
b185da93a3
Binary file not shown.
|
@ -123,6 +123,7 @@ class SendtoServer(unohelper.Base, XJobExecutor):
|
|||
self.win.addFixedText("lblReportName", 2, 30, 50, 15, "Technical Name :")
|
||||
self.win.addEdit("txtReportName", -5, 25, 123, 15,report_name)
|
||||
self.win.addCheckBox("chkHeader", 51, 45, 70 ,15, "Corporate Header")
|
||||
self.win.setCheckBoxState("chkHeader", True)
|
||||
self.win.addFixedText("lblResourceType", 2 , 60, 50, 15, "Select Rpt. Type :")
|
||||
self.win.addComboListBox("lstResourceType", -5, 58, 123, 15,True,itemListenerProc=self.lstbox_selected)
|
||||
self.lstResourceType = self.win.getControl( "lstResourceType" )
|
||||
|
@ -190,7 +191,6 @@ class SendtoServer(unohelper.Base, XJobExecutor):
|
|||
#sock = xmlrpclib.ServerProxy(docinfo.getUserFieldValue(0) +'/xmlrpc/object')
|
||||
|
||||
file_type = oDoc2.getURL()[7:].split(".")[-1]
|
||||
res = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'upload_report', int(docinfo.getUserFieldValue(2)),base64.encodestring(data),file_type,{})
|
||||
params = {
|
||||
'name': self.win.getEditText("txtName"),
|
||||
'model': docinfo.getUserFieldValue(3),
|
||||
|
@ -200,7 +200,12 @@ class SendtoServer(unohelper.Base, XJobExecutor):
|
|||
}
|
||||
if self.win.getListBoxSelectedItem("lstResourceType")=='OpenOffice':
|
||||
params['report_type']=file_type
|
||||
res = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'write', int(docinfo.getUserFieldValue(2)), params)
|
||||
self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'write', int(docinfo.getUserFieldValue(2)), params)
|
||||
|
||||
# Call upload_report as the *last* step, as it will call register_all() and cause the report service
|
||||
# to be loaded - which requires all the data to be correct in the database
|
||||
self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'upload_report', int(docinfo.getUserFieldValue(2)),base64.encodestring(data),file_type,{})
|
||||
|
||||
self.logobj.log_write('SendToServer',LOG_INFO, ':Report %s successfully send using %s'%(params['name'],database))
|
||||
self.win.endExecute()
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue