Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Cron job not working in Odoo 15

Odebírat

Get notified when there's activity on this post

This question has been flagged
v15
3 Odpovědi
8186 Zobrazení
Avatar
MercTrans

I tried to create a cron job in Odoo 15 and it is not working at all even though the terminal returns that the cron job was executed. 


I used this in my "automation.xml" file: 

noupdate="0">
id="ir_cron_scheduler_sync_status_action" model="ir.cron">
name="name">Auto Sync Payment Status
name="model_id" ref="model_model_name"/>
name="state">code
name="code">model.test_cron()
name="user_id" ref="base.user_root"/>
name="interval_number">1
name="interval_type">minutes
name="numbercall">-1

And my function is as simple as this:

@api.model
def test_cron(self):
print("test cron")


But when I run this scheduled action manually or I just let the server executes it, nothing is printed in the terminal. What might be the issue here? Please help!


0
Avatar
Zrušit
Avatar
shubham shiroya
Nejlepší odpověď

Here are some possible solutions to troubleshoot the issue:

  1. Check Cron Configuration: Ensure that your cron job is properly configured in the automation.xml file. Double-check the correctness of the element structure and attributes, such as name, model_id, state, code, user_id, interval_number, and interval_type.log files are located in the Odoo installation directory. Look for any relevant entries that may provide insights into the issue.

  2. Enable Developer Mode: Enable the developer mode in Odoo to see detailed error messages. You can enable it by adding ?debug at the end of the URL or by activating the developer mode through the user interface (by going to "Settings" -> "Activate the Developer Mode").

  3. Restart Odoo Service: Restart the Odoo service to ensure that any changes made to the cron job or module are properly applied. Sometimes, changes may not take effect until the service is restarted.

  4. Verify Access Rights: Ensure that the user specified in the user_id attribute of the cron job has the necessary access rights to execute the job. The user should have appropriate permissions on the model and its associated methods.

  5. Check Server Timezone: Make sure the server's timezone is correctly set. Cron jobs in Odoo are executed based on the server's timezone configuration. Verify that the timezone is set correctly in the Odoo configuration file (odoo.conf).


0
Avatar
Zrušit
Avatar
Christopher DATO
Nejlepší odpověď

Sorry for the late response,
The print() function won't display anything in odoo log file.
You should use a logging function to display infos in odoo log.

See example below:

import logging
_logger=logging.getLogger(__name__) 
_logger.info("MY FIRST INFO LOG")

I hope I've helped you...

0
Avatar
Zrušit
Avatar
Nejlepší odpověď

Hello,

For the XML code:

 


For the python code:

@api.model
def test_cron(self):
print("test cron")

Be sure that the xmlfile is imported in the _manifest.py and the python file is imported in the __init_.py file.

For the model_id in the xml file:

You have to set model.model_name where the model is the name of your application and model_name is the name of your model where the function test_cron is declared.


Best regards,

Imal-Tech
 
Imal-Tech team




0
Avatar
Zrušit
MercTrans
Autor

The problem is I already added the xml file and python file to manifest and init. The cron job actually runs but it doesn't execute the function.

MercTrans
Autor

odoo_web | 2022-10-23 04:03:17,213 43 INFO merctrans odoo.addons.base.models.ir_cron: Starting job `Auto Sync Payment Status`.
odoo_web | 2022-10-23 04:03:17,215 43 INFO merctrans odoo.addons.base.models.ir_cron: Job `Auto Sync Payment Status` done.
odoo_web | 2022-10-23 04:04:20,286 43 INFO merctrans odoo.addons.base.models.ir_cron: Starting job `Auto Sync Payment Status`.
odoo_web | 2022-10-23 04:04:20,287 43 INFO merctrans odoo.addons.base.models.ir_cron: Job `Auto Sync Payment Status` done.
odoo_web | 2022-10-23 04:05:23,444 43 INFO merctrans odoo.addons.base.models.ir_cron: Starting job `Auto Sync Payment Status`.
odoo_web | 2022-10-23 04:05:23,451 43 INFO merctrans odoo.addons.base.models.ir_cron: Job `Auto Sync Payment Status` done.
odoo_web | 2022-10-23 04:06:26,610 43 INFO merctrans odoo.addons.base.models.ir_cron: Starting job `Auto Sync Payment Status`.
odoo_web | 2022-10-23 04:06:26,617 43 INFO merctrans odoo.addons.base.models.ir_cron: Job `Auto Sync Payment Status` done.
odoo_web | 2022-10-23 04:06:32,467 44 INFO merctrans odoo.addons.base.models.ir_cron: Starting job `Auto Sync Payment Status`.
odoo_web | 2022-10-23 04:06:32,481 44 INFO merctrans odoo.addons.base.models.ir_cron: Job `Auto Sync Payment Status` done.

You can see here that the cron job runs, but doesn't print anything to terminal

Jakub Sedinar

Hi, did you manage to fix it? or do you need help?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Prevent navigation if records are not save
v15
Avatar
Avatar
Avatar
2
říj 25
3504
Creating user creates duplicated partner_id
v15
Avatar
Avatar
1
zář 25
3373
Sales order line comment to Purchase order line comment Vyřešeno
v15
Avatar
Avatar
3
čvc 25
4570
attribute is not applied when dynamically rendering
v15
Avatar
1
kvě 25
2714
Odoo Custome Module Language Creation
v15
Avatar
Avatar
Avatar
Avatar
4
kvě 25
4152
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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