Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How can i change the below webkit report code to aero report?

By
samba
on 8/26/14, 11:04 AM 968 views

 I am learning how to generate reports in openerp. I am facing problem in changing webkit report in to aero i.e instead open in PDF i want to open in excel. How can i proceed for this?

.py file

....................................................................................

from openerp.osv import fields,osv
from openerp import netsvc
class models_wizard(osv.osv_memory):
    _name='models.wizard'
    _columns={
    'date1':fields.date('From date'),
    'date2':fields.date('To Date')
    }
    def get_data(self,cr,uid,ids,context=None):
        wizard_record=self.browse(cr,uid,ids[0],context)
        domain=[('date','>=',wizard_record.date1)]
        models_models_object=self.pool.get('models.models')
        data_ids=models_models_object.search(cr,uid,domain,context=context)
        if not data_ids:
            raise osv.except_osv('Error!','There are no ids!')
            return False
        else:
            datas={
            'ids':data_ids,
            'model':'models.models',
            }          

return {
                'type':'ir.actions.report.xml',
                'report_name':'models.webkit.report',
                'datas':datas,
                'context':context

        }

...........................................................................................................................

XML file

.....................................................................................................................................

<openerp>
    <data>
        <record model='ir.ui.view' id='models_wizard_form'>
            <field name="name">models.wizard.form</field>
            <field name='model'>models.wizard</field>
            <field name='arch' type='xml'>
                <form string="wizard" version='7.0'>
                    <sheet>
                        <field name="date1"/>
                        <field name='date2'/>  
                    </sheet>
                    <footer>
                        <button special="cancel" string="Cancel"/>
                        <button type="object" name="get_data" string="getdata"/>
                    </footer>
                    
                </form>
                
            </field>
        </record>
        <record id="models_wizard_action" model="ir.actions.act_window">
            <field name="name">models.wizard.action</field>
            <field name="res_model">models.wizard</field>
            <field name="view_mode">form</field>
            <field name="view_type">form</field>
            <field name="target">new</field>
        </record>
        <menuitem id="models_wizard_menu" action="models_wizard_action" parent="models_models_menu_child" />
    </data>
</openerp>

....................................................................................................

Report xnl file

........................................................................................................

<openerp>
    <data>
        <report
                auto="False"
                id="models_webkit"
                model="models.models"
                name="models.webkit.report"
                file="reportgeneration/report/models_webkit_report.mako"
                string="models Webkit Report"
                report_type="webkit" />
    </data>
</openerp>

..............................................................................................................................................................

mako file

............................................................................

<html>
    <body>
    
        <table border="1.0" width="100%">
                <tr>
                    <th>name</th>
                    <th>code</th>
                    <th>date</th>
                </tr>
            %for emp in objects:
                <tr>
                    <td>${emp.code}</td>
                    <td>${emp.name}</td>
                    <td>${emp.date}</td>
                    
                </tr>
                %endfor
            </table>
    </body>
</html>

.......................................................................................................................................................................

I have added properly these files to __openerp__.py and __init__.py. Can any one please help me?

1

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5995
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 8/27/14, 1:11 AM

Hi,

In your .py file you have to return as like below.

 return {
                'type':'ir.actions.report.xml',
                'report_name':'models.webkit.report',
                'datas':datas,
                'context':context

        }

Note : Here (in return) you have to give the name of the report which you have given into <report> record.

Thank you, This solved my problem....

samba
on 8/27/14, 3:36 AM

Your always welcome :)

Emipro Technologies Pvt. Ltd.
on 8/27/14, 3:50 AM

Is it possible to change this report to aero report. i.e the report should open in excel instead of pdf

samba
on 8/27/14, 5:03 AM

Yes, it is possible.

Emipro Technologies Pvt. Ltd.
on 8/27/14, 6:03 AM

Please Can you tell me how?

samba
on 8/28/14, 2:23 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/26/14, 11:04 AM
Seen: 968 times
Last updated: 3/16/15, 8:10 AM