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.

1

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 6/30/14, 8:45 AM

Hi,

I will explain how to create report in v7 use rml.. please follow this code

 

create a folder structure inside ur custom module like

ur_modulename/report

 inside this create  folder create one  init.py,urname.rml,report.py   file

 

after that

1)init.py

import employee_report


2) .rml

<?xml version="1.0"?>
<document filename="test.pdf">
  <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
    <pageTemplate id="first">
      <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
    </pageTemplate>
  </template>
  <stylesheet>
    <blockTableStyle id="Standard_Outline">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Table1">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,0" stop="1,-1"/>
      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,1" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,1" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,2" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,2" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,2" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,3" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,3" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,3" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,4" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,4" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,4" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,5" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,5" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,5" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,6" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,6" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,6" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,7" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,7" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,7" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,8" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,8" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,8" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,9" stop="0,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
      <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,9" stop="1,-1"/>
      <lineStyle kind="LINEAFTER" colorName="#000000" start="1,9" stop="1,-1"/>
      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
    </blockTableStyle>
    <initialize>
      <paraStyle name="all" alignment="justify"/>
    </initialize>
    <paraStyle name="Standard" fontName="Helvetica"/>
    <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
    <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
    <paraStyle name="Index" fontName="Helvetica"/>
    <paraStyle name="Table Contents" fontName="Helvetica"/>
    <images/>
  </stylesheet>
  <story>
    <para style="Standard">[[ repeatIn(objects,'employee') ]]</para>
    <para style="Standard">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="241.0,241.0" style="Table1">
      <tr>
        <td>
          <para style="Table Contents">Name</para>
        </td>
        <td>
          <para style="Table Contents">Salary</para>
        </td>
      </tr>
      <tr>
        <td>
          <para style="Table Contents">[[ employee.name ]]</para>
        </td>
        <td>
          <para style="Table Contents">[[ employee.salary ]]</para>
        </td>
      </tr>
      <tr>
        <td>
          <para style="Table Contents">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="Table Contents">
            <font color="white"> </font>
          </para>
        </td>
      </tr>

    </blockTable>
    <para style="Standard">
      <font color="white"> </font>
    </para>
  </story>
</document>

 

3)report.py


from report import report_sxw

class order(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(order, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            
         })

report_sxw.report_sxw('report.employee.info', 'info.employee', 'addons/mymodule/report/employee_info.rml', parser=order, header=False)
report_sxw.report_sxw('report.employee.info1', 'info.employee', 'addons/mymodule/report/employee_info1.rml', parser=order, header=False)
report_sxw.report_sxw('report.employee.info2', 'info.employee', 'addons/mymodule/report/employee_info2.rml', parser=order, header=False)

 

inside module name

add init.py and openerp.py

init.py

import report

openerp.py

 

{
   'name' : 'Employee Details',
   'version' : '7.0',
   'author' : '',
   'website' : '',
   'depends' : ['sale'],
   'category' : 'General',
   'description' : '''This module contains information about Employee.''',
   'update_xml' : [
                   'wizard/employee_wizard_view.xml',
                   'employee_info_report.xml', #this is ur rport .xml file
                   'Employee_info_view.xml'
                  ],

   'demo_xml' : []
 
}

 

Employee_info_view.xml --------------

 

<button name="%(employee_wizard_action)d" string="call wizard" type="action"/>
                            <button name="%(mymodule.report_employee_info)d" string="Click for report" type="action" />                

employee_info_report.xml--------

 

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <report auto="False" id="report_employee_info" model="info.employee" name="employee.info" rml="mymodule/report/employee_info.rml" string="Employee info"/>

    </data>
</openerp>

 

 

 

 

 

 

2

Ray Carnes

--Ray Carnes--
15677
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 6/30/14, 12:39 PM

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: 6/30/14, 7:50 AM
Seen: 1308 times
Last updated: 3/16/15, 8:10 AM