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

(<type 'exceptions.NameError'>, NameError("name 'get_lines_machine' is not defined",), <traceback object at 0x043E52D8>)

By
souha
on 7/17/13, 11:00 AM 703 views

I am receiving the following error when trying to run my script:

code: fiche_reclamation.py

import time from report import report_sxw from osv import osv import pooler

class fiche_reclamation(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(fiche_reclamation, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'get_lines_machine': self.get_lines_machine, })

def get_lines_machine(self, cr, uid, fields, context=None):
  if context is None:
        context = {}
  resultat=[]
  res={}
    self.cr.execute('SELECT * \
             FROM cmms_incident \
           WHERE (cmms_incident.equipement_id=cmms_equipement.id)')
    partners = self.cr.fetchall()
    for row in partners:
      res={}
      res['id']=row.id
      res['create_uid']=row.create_uid
      res['create_date']=row.create_date
      res['write_date']=row.write_date
      res['write_uid']=row.write_uid
      res['user_id']=row.user_id
      res['name']=row.name
      res['priority']=row.priority
      res['date']=row.date
      res['state']=row.state
      res['active']=row.active
      res['ref']=row.ref
      resultat.append(res)
      return resultat

report_sxw.report_sxw('report.cmms.equipement', 'cmms.equipement', 'addons/machine_/report/fiche_reclamation.rml', parser=fiche_reclamation)


code: fiche_reclamation.sxw


[[ repeatIn(objects,'fiche_reclamation') ]] id: [[ line['id'] ]]


i replace cursor with pool but it still the same problem :( help

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

0 follower(s)

Stats

Asked: 7/17/13, 11:00 AM
Seen: 703 times
Last updated: 3/16/15, 8:10 AM