Odoo Help


Custom report why cant access all object atributes

on 6/30/16, 4:13 AM 301 views

I have created a report which is working fine (Accounting, Journal entries). What i want now is to get some data from other model (res.partner), so i need to call python function from qweb report, as i understand i need to make a custom report like in example here - https://www.odoo.com/documentation/9.0/reference/reports.html#custom-reports

So i did it all like in an example, but after installing my module with custom class im getting an error:

 "'report.l10n_lt_buh_aps_forma.report_buh_aps_forma_' object has no attribute 'line_ids'" while evaluating


As i understand after installing module with this custom class i cant access all object attributes. Here is my code:

from openerp import api, models, fields
def some_math(txt):
return txt * 5
def get_formato(self):
return 'its working'
class buh_aps_report(models.AbstractModel):
_name = 'report.l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
#_template = 'l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
# _inherit = 'account.move'
def render_html(self, data=None):
report_obj = self.env['report']
report = report_obj._get_report_from_name('l10n_lt_buh_aps_forma.report_buh_aps_forma_lt')
docargs = {
'doc_ids': self._ids,
'doc_model': report.model,
'docs': self,
'some_math': some_math,
'get_formato': get_formato,
return report_obj.render('l10n_lt_buh_aps_forma.report_buh_aps_forma_lt', docargs)

Here is my template code:

string="Buhalterinės apskaitos forma (EN text)"

And i have to mention, that i have found some older way to for my problem, which is actually working:

class buh_aps_report(report_sxw.rml_parse):

  def __init__(self, cr, uid, name, context):
  super(buh_aps_report, self).__init__(cr, uid, name, context=context)
  'time': time,
  def get_format(self):
  return 'its working'
 class report_saleorderqweb(models.AbstractModel):
  _name = 'report.l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
  _inherit = 'report.abstract_report'
 _template = 'l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
  _wrapped_report_class = buh_aps_report

As i understand second method is based on old API, so i would like to understand what i did wrong in first method, what is missing?

Im completely new to python and odoo, so any help will be appreciated, thank you

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/30/16, 4:13 AM
Seen: 301 times
Last updated: 6/30/16, 5:07 AM