Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

debugging python code

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
debugpythonprint
2 Risposte
14336 Visualizzazioni
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
Abbandona
Avatar
AJ Schrafel Paper Corp
Risposta migliore

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
Abbandona
Anuradha
Autore

Yes finally it worked thanks alot patently.

Avatar
nazarii
Risposta migliore

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
Abbandona
Anuradha
Autore

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
Autore

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
Autore

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.

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
How to detect debug mode in python side? Risolto
debug python
Avatar
Avatar
Avatar
Avatar
Avatar
4
mar 22
13712
How to Debug python code in open erp Risolto
debug print
Avatar
Avatar
Avatar
Avatar
Avatar
16
dic 23
73724
Impossible to print in standard output
modules python print
Avatar
Avatar
Avatar
3
mag 25
4266
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
5326
Is anyone using WINPDB (Python Debugger) with v9? I was available with v7 and v8
debug python v9
Avatar
Avatar
1
mag 16
4603
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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