Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

debugging python code

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
debugpythonprint
2 Antworten
14332 Ansichten
Avatar
Anuradha
I have been trying different debugging methods but everything fails.How can i print a variable or msg in log.

i am using tail -f /var/log/openerp/openerp-server.log& for log

my code is 
import logging
from openerp.osv import fields, osv
import time
print "a"*1000

_logger = logging.getLogger(__name__)
class calldata_print_report_wiz(osv.osv_memory):
    _name = "calldata.print.report.wiz"

    def _sel_func(self, cr, uid,context=None):

     print "hello"*100
     obj = self.pool.get('calldata1')
     ids = obj.search(cr, uid, [])
     res = obj.read(cr, uid, ids, ['Caller'], context)
     _logger.debug('Create a %s with vals %s', self._name, res)
     res =[r['Caller'] for r in res]
     return res

    _columns = {
        'date_start': fields.date('Date Start', required=True),
        'date_end': fields.date('Date End', required=True),
#        'Callers':fields.many2one(
 #       'calldata1',

  #   'Callers',
   #     selection=_sel_func
    #    )
       'caller_id':fields.selection(_sel_func, string='Caller'),
   }
    _defaults = {
        'date_start': lambda *a: time.strftime('%Y-%m-%d'),
        'date_end': lambda *a: time.strftime('%Y-%m-%d'),


     }

    def print_report(self, cr, uid, ids, context=None):
      import pdb
      pdb.set_trace()
       import netsvc
       netsvc.Logger().notifyChannel('calldetails1', netsvc.LOG_DEBUG, "Hello")

      if context is None:
            context = {}

      datas = {'ids': context.get('active_ids', [])}
      res = self.read(cr, uid, ids, ['date_start', 'date_end', 'Caller_id'], context=context)
      res = res and res[0] or {}
      datas['form'] = res
      return {
            'type': 'ir.actions.report.xml',
            'report_name':'call',
           }
calldata_print_report_wiz()

Any one please help?

0
Avatar
Verwerfen
Avatar
AJ Schrafel Paper Corp
Beste Antwort

Put the _logging declaration inside the function you want to log and start/stop the server. That will make the log messages start to appear

Also start the server in debug mode or change the logging from .debug to .info

0
Avatar
Verwerfen
Anuradha
Autor

Yes finally it worked thanks alot patently.

Avatar
nazarii
Beste Antwort

There could be several reasons:

  1. Have you restarted the server to apply new print statements?
  2. Be sure you are reading correct log file(perhaps you specified another one when started the server adding -c or config?). If you see current time reading your log the file you are reading is correct.
  3. Why are you launching reading the file as background process? You don't need '&' at the end of command.
  4. Go to Settings --> Configuration --> Database structure --> Objects and check whether there is such a model calldata.print.report.wiz in your database, if not - you forgot to include you file in __init_ section of module. Besides there is no reason to use pdb module in you code as it wouldn't work while you are only reading the file. Cheers.
0
Avatar
Verwerfen
Anuradha
Autor

yes i restarted the server. i restarted server using this command sudo /etc/init.d/openerp restart --debug .there exists calldata.print.report.wiz table in my database.Still why its not showing my print statement result :( ? my configuration file for open erp is /etc/openerp/openerp-server.conf
[options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = False db_port = False db_user = openerp db_password = False

nazarii

Append following line to conf file: logfile = /var/log/openerp/openerp-server.log and restart the server.

Anuradha
Autor

changed configuration and restarted . still no change :(.

nazarii

Hm, is there any output in console after running tail -f /var/log/openerp/openerp-server.log and accessing server throw web browser?

Anuradha
Autor

yes it shows errors if any,login info etc

nazarii

Ok, let's try the last thing - insert in your code next method: def init(self, cr): print "Hello World"*100 and restart the server. If it will not print - your module is not updating, otherwise try to use 'caller_id' as functional field, not selection.

Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
How to detect debug mode in python side? Gelöst
debug python
Avatar
Avatar
Avatar
Avatar
Avatar
4
März 22
13709
How to Debug python code in open erp Gelöst
debug print
Avatar
Avatar
Avatar
Avatar
Avatar
16
Dez. 23
73720
Impossible to print in standard output
modules python print
Avatar
Avatar
Avatar
3
Mai 25
4265
Integrate Odoo11 with Intellij 2017.3.2 to set a break point at the code on windows 10
debug python odoo11
Avatar
1
Apr. 18
5325
Is anyone using WINPDB (Python Debugger) with v9? I was available with v7 and v8
debug python v9
Avatar
Avatar
1
Mai 16
4599
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now