0

I created a folder called Student. When i open this module i am getting the above said error. this is my opennerp file,

{
   'name': "Student",
   'version': '1.0',
   'sequence': 7,
   'depends': ['base','report'],
   'author': "ZD",
   'category': 'Testing',
   'description': "Module used for testing purpose only",
   'data': [
    'student_custom_view.xml',
    'views/Student_report123.xml',
    'Student_report.xml',
   ],
   'installable': True,
   'auto_install': False,         
}

Then in .py file,

 class student(models.Model):
_name = 'student'
name = fields.Char(string='Number', compute='_compute_name')
total2 = fields.Char(string='Total in words', compute='_compute_total')

student_report.xml,

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <report 
        id="Student_report123"
        string="Report"
        model="student" 
        report_type="qweb-pdf"
        file="Student.Student_report123" 
        name="Student.Student_report123" 
        attachment_use="False"
   />
</data>
</openerp>

Inside views folder i created a file called Student_report123.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="Student_report123">
 <t t-call="report.external_layout">
     <div class="page">
        <div class="row"> 
            <span t-field="o.total2"></span>
        </div>
    </div>
  </t>
 </template>
</data>
</openerp>
Kiran
  • 1,481
  • 6
  • 36
  • 66

2 Answers2

1

you can try this code:

<t t-name="student_report123">
    <t t-call="report.external_layout">
        <div class="page">
           <div class="row">
              <h2>Success</h2>
              <span t-field="o.total2"/>
           </div>
        </div>
    </t>
 </t>
Jainik Patel
  • 2,284
  • 1
  • 15
  • 35
  • your report id and template id are same so you cane define different name of report and you xml file name like that student_report_views.xml – Jainik Patel Nov 19 '15 at 12:07
1

Under you student_report.xml file and student_report123.xml file the id provided are xml ids and no two xml ids are allowed same. Xml IDs must be unique throughout the database.

Hardik Patadia
  • 1,969
  • 16
  • 20
  • in student_report.xml (report declaration file), can u tell me what is model attribute and name attribute i am little confused between those two – Kiran Nov 20 '15 at 06:58
  • model refers to the model specified in the 'py' file for '_name' attribute and 'report name' is the name of the report. So by this system can get to know for which model you are preparing this report and what is it name. For example when you are on the reports list and if you want to search for any report than you can type in the search string and select it against the 'name' field of the report it will search for name of report whereas if you select it against the 'object' attribute than it will refer to the 'model' field of report, which is in your case is 'student' – Hardik Patadia Nov 20 '15 at 10:28