How can i print a report from odoo server actions (GUI) - odoo

How can I make a server action in the GUI of odoo 10 to print the custom picking report
Report id: id=690
(I am trying to make an automated action to print al new confirmed orders)

I just noticed that this module supports odoo 10
https://apps.odoo.com/apps/modules/15.0/printnode_base/
This is probably your best bet.
To get the report from the odoo server:
{server}/report/pdf/{report_id}/{object_id}
example:
https://odoo.yourcompany.com/report/pdf/account.report_invoice_with_payments/70
I don't have access to Odoo 10, but for modern Odoos you can generate the report like that:
pdf_data = self.env.ref('account.report_invoice_with_payments').with_user(SUPERUSER_ID)._render_qweb_pdf([invoice.id])[0]
This pdf_data is pdf data as bytes that can be posted to the server or saved to a file.

Related

Export SSRS report in pdf format from SSIS

I've a situation, where I need to export a report from my report server to my local in pdf format through SSIS package.
This can be done from a Script Task. An example of this is below with C# as the language used.
Add an HTTP Connection Manager. For the Server URL enter the url for the report server. You find this in Reporting Services Configuration Manager on the Web Service URL pane. Make sure to use credentials with the appropriate privileges. I recommend testing and verifying the before proceeding.
Add a C# Script Task with the code below. The ServerURL property will be the as follows:
Report server URL + ?/ + report name including the path with the SSRS folder + the command options (beginning with first &rs below). In this case Format=PDF is for saving in PDF format.
// this will be the name that was given to the HTTP Connection manager when it was created
ConnectionManager conn = Dts.Connections["HTTP Connection Manager"];
HttpClientConnection httpConn = new HttpClientConnection(conn.AcquireConnection(null));
// location where PDF will be saved to
string outputPDF = #"C:\Test\NameOfReport.pdf";
httpConn.ServerURL = #"http://YourReportServer?/Folder of Report/Report Name&rs:Command=Render&rs:Format=PDF&rc:Toolbar=False";
// second parameter of true indicates to overwrite file
httpConn.DownloadFile(outputPDF, true);
You could use a Script Task in SSIS to export the report from SSRS. Take a look at the following blog post. It explains how to export an SSRS report via SSIS. https://sqlserverrider.wordpress.com/2013/02/15/generate-pdf-report-from-ssis/
Also, this forum thread has some other examples: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d6ac1ba5-90a2-403b-898e-edaab3c7b270/generate-ssrs-pdf-from-ssis?forum=sqlintegrationservices

Odoo error after installing xls report

I added xls engine and webkit addons. I am using Windows 2008 server. When I try to print ledger reports, it gives the following error:
Required report does not exist: account.account_report_general_ledger_xls
<type 'exceptions.Exception'>,Required report does not exist: account.account_report_general_ledger_xls,<traceback object at 0x1030CE40
Can any one guide me what im doing wrong? I did the same steps on another windows 7 server, its not giving me any error.
It seems that odoo can't find the report. Did you try an update all? Or take a look and try to find the report in database.

"Failed to load database information" when running a crystal report using crexporter

I built a report in Crystal Report 2013 and need to run it using crexport. The report ran w/o any problems in CR 2013 but when it was run in crexport I received this message
Error : Failed to load database information.
Below are the contents from the log file. I appreciate any advises. Thanks in advance!
Crystal Reports Exporter version 2.1.11.1103
creport parameters : -F C:\Junk\Crystal\2014 Charts by Hospital FINAL2.rpt -O C:\Junk\Crystal\\2014 Charts by Hospital FINAL2.pdf -E pdf -l -a HospitalID:xxxxxxx (I intentionally removed the hospital number) -a Start Date:11/1/2014 -a End Date:11/30/2014
Instantiated ReportDocument object
Crystal Reports file C:\Junk\Crystal\2014 Charts by Hospital FINAL2.rpt loaded
Database id = 0
Integrated Security = False
Default Server Name = C:\Junk\Crystal\B2014.mdb
Default Database Name = C:\Junk\Crystal\B2014.mdb
Integrated Security = true
Integrated Security = true
Report Output format set to : pdf
Report attribute : HasSavedData = False
Discrete Parameter : HospitalID = xxxxxxx
Error : Failed to load database information.Error in File 2014 Charts
by Hospital FINAL2 {AB15DB0B-AB85-4E40-BECC-5E6416B7EFC5}.rpt:Failed
to load database information. ReportDocument closed
BTW, I followed the instructions from the link below and installed the crexport and associated programs.
http://www.itsupportguides.com/crystal-reports/crystal-reports-run-and-email-report-using-crexport-and-blat/
Using integrated security doesn't make sense with MS Access databsae. Try to set user name. If you did not set password use user name "Admin".
Best will be to contact their customer support, if they have one. You can also check some more popular tools on Ken Hamady's website .I guess they will work with less issues because they have more customers. Some like Crystal Delivery 10 and R-Tag Report Manager are free.

<adlcp:map> in scorm 2004 4th edition

We are building API for scorm 2004 4th edition , we start using the the official Test Suite but in the DMI test we get the following error :
"ERROR: Attempted to access an objective with the id "tarID1" but "tarID1" was not found."
when i looked in the manifest xml file i found that those elements are defined as "adlcp:map" , where shall i save this tag ? what this tag represent ?
Anything you would want to know about any element in a manifest (assuming it doesn't utilize third-party extensions) can be found in the official SCORM documentation.
Download the documentation suite. In the CAM book, look for section 3.4.1.19, titled "<map> Element".
Source: SCORM 2004 4th Edition Content Aggregation Model (CAM) Book, available from adlnet.gov (download the documentation suite).
This is used for shared buckets, or data which can be accessed and set across courses/SCO's. For example, you might have a pretest and need that score/user answers in another SCO for providing feedback.
For those looking for more info on implementation:
Add this to your item (organisation > item) in the manifest:
<adlcp:data>
<adlcp:map targetID="mybucketname" readSharedData="true" writeSharedData="true"/>
</adlcp:data>
JS part (Use your API calls in place of LMSGetValue and LMSSetValue)
var dataBucketsCount = LMSGetValue("adl.data._count");
dataBucketsCount = parseInt(dataBucketsCount);
for (var i=0; i < dataBucketsCount; i++){
if (LMSGetValue("adl.data." + i + ".id") == "mybucketname"){
//do your processing with the data
}
}
You can google for RTE Handbook SCORM 2004 4th edition, to get details on the manifest elements.
However this is a lovely way to save data from one course and get it in other, provided your LMS supports it. Also, the character limit is same as suspend data.

I would like to extract the SQL queries from Crystal Report .rpt files, is there a way to do this?

I would like to extract the SQL queries from Crystal Report .rpt files, is there a way to do this?
I don't have any of the Crystal Reports products, just the .rpt files.
Here's a .Net example of code that grabs the Command Sql from all Crystal Reports in a given directory. It requires the Crystal 2008 .Net SDK to be installed (you can download a trial from SAP):
foreach (string file in Directory.GetFiles("c:\\projects\\Reports", "*.rpt"))
{
Console.WriteLine(String.Format("Processing {0}...", file));
var doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
doc.Load(file);
foreach (dynamic table in doc.ReportClientDocument.DatabaseController.Database.Tables)
{
if (table.ClassName == "CrystalReports.CommandTable")
{
string commandSql = table.CommandText;
//TODO: do something with commandSql
}
}
}
To get the SQL as Crystal would build it when running a report, see this link: SAP Note 1280515 - How to extract SQL query from Crystal reports using RAS sdk.
I believe to do this, you need to supply the report parameter values so that Crystal can connect to the database in order to build the SQL. In the example, since a Report Viewer control is used, Crystal can prompt the user for the parameters.
In "Crystal Reports ActiveX Designer Design and Runtime Library" (craxddrt.dll), the Report.SQLQueryString property will do what you want.
I can't seem to find an equivalent property in the .Net SDK, and believe me, I've been looking.
** edit **
It appears that one can make use of the In-Process RAS Server to get this information:
CrystalDecisions.ReportAppServer.DataDefModel.CommandTableClass.CommandText
The other way around this is if you can run the reports, you can hook up SQL Profiler to your DB and capture the incoming SQL on the database side.
JoshL's answer worked for several of my reports, but not all of them. The following method, using ReportClientDocument.RowsetController.GetSQLStatement, was able to extract some of the queries that the other method missed.
foreach (string file in Directory.GetFiles("c:\\projects\\Reports", "*.rpt"))
{
Console.WriteLine(String.Format("Processing {0}...", file));
var doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
doc.Load(file);
var controller = doc.ReportClientDocument.RowsetController;
var groupPath = new CrystalDecisions.ReportAppServer.DataDefModel.GroupPath();
string temp = String.Empty;
string commandSql = controller.GetSQLStatement(groupPath, out temp);
//TODO: do something with commandSql
}
My experience is with older versions of Crystal (8,9) - I've no idea what the file formats look like for more recent versions. However, it's worth opening the files up in a text editor just in case, but for the file formats I've seen, the query text is not accessible this way.
If I remember correctly, some versions of Visual Studio 2003 came with tools for manipulating Crystal .rpt files (but I guess this isn't of much use to you, since if you had this already, you wouldn't be asking!).
It's not a very imaginative suggestion, but perhaps your quickest route would be to download the 30-day trial version of the current Crystal Reports, and see if that will open the files for you.
In the Visual studio, select the .rpt file and Go to field explorer, right click on DatabaseFields. Click on SQL query option to view the query.