İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Cron job does not execute python code on scheduler, only on Run Manually button.

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
croncronjob
3 Cevaplar
12816 Görünümler
Avatar
Gagea Alexandru

Hello,


The bellow code inserts data from another database into postgres table product.public.category. 

My goal is to run this on a scheduler. I've configured a cron job to run every hour for this method.


The cron job executes python code: model.get_grupe() . The issues here is that the code does not get executed on the cron instead if i click on Run Manually button from the cron, it will work.

What can I do to make it work on the scheduler ? 


Odoo 13 CE.


def get_grupe(self):

        lst = self.get_from_borg('GrupeProduse')

        grupe = self.env['product.public.category'].search([])

        for item in lst:

            it = item.split('\t')

            if it[0].isdigit():

                id_cat = it[0]

                name_categ = it[1].title()

                type = it[2]

                id_ramura = it[3]

                name_ramura = it[4].title()

                parent_id = False

                ramura = grupe.search(

                    [('parent_id', '=', False), ('id2', '=', id_ramura)])

                if ramura:

                    parent_id = ramura[0].id

                    ramura[0].name = name_ramura

                else:

                    ramura = self.env['product.public.category'].create({

                        'id2': id_ramura,

                        'name': name_ramura,

                        'parent_id': False

                    })

                    parent_id = ramura.id

                grupa = grupe.search([('parent_id',  '!=', False) ,('id2', '=', id_cat)])

                if grupa:

                    grupa[0].write({

                        'name': name_categ,

                        'parent_id': parent_id

                    })

                else:

                    self.env['product.public.category'].create({

                        'id2': id_cat,

                        'name': name_categ,

                        'parent_id': parent_id

                    })


Thank you.

1
Avatar
Vazgeç
Jainesh Shah(Aktiv Software)

Can you please add your scheduler code.

Gagea Alexandru
Üretici

<record id="sync_categories" model="ir.cron">

<field name="interval_type">hours</field>

<field name="interval_number">2</field>

<field name="name">Sync categories</field>

<field name="user_id" ref="base.user_root"/>

<field name="numbercall">-1</field>

<field name="priority">5</field>

<field name="doall">False</field>

<field name="active">False</field>

<field name="interval_number">1</field>

<field name="model_id" ref="model_borg_client"/>

<field name="state">code</field>

<field name="code">model.get_grupe()</field>

</record>

Avatar
Gagea Alexandru
Üretici En İyi Yanıt

Issue solved, the problem was because of the translations. I was updating only the category name  in the product categories table and I  had to update the translation for the category as well in the ir.translation table.

0
Avatar
Vazgeç
Mahmoud

i have the same problem but what you say is not the solution :(

Avatar
Adil Akbar
En İyi Yanıt

Hi, you can follow this link for this:

https://youtu.be/iBvtwy8x_E0

Hope it helps,

Thanks

0
Avatar
Vazgeç
Avatar
Prakash
En İyi Yanıt


Check Preference --> Timezone  = Current user timezone.

If other timezone may be delay to auto execute.

or you can debug code adding _logger in your cron job method.

import logging
_logger = logging.getLogger(__name__)

_logger.warning('Cron Job testing')


0
Avatar
Vazgeç
Gagea Alexandru
Üretici

The job executes when it should. So, my code updates data in product_public_category table. I've deleted all records in the table and now the table gets populated at the right time, every time without deleting the data in the table anymore. However I cannot delete the data in the production database just to make the scheduler work. I need to find another solution.

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

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Using CRON job to download and attach pdf to binary field ODOO16
cron cronjob ODOO16
Avatar
0
Eki 24
3043
Cron getting timeout
cron timeout cronjob
Avatar
Avatar
1
Ağu 24
6128
How can i run a single auto scheduler in Odoo for multiple users at the same time?
cron scheduler cronjob
Avatar
0
May 21
4555
Cron Job issue
cron nginx cronjob AttributeError
Avatar
Avatar
Avatar
Avatar
3
Eyl 25
4081
Cron job showing error: RuntimeError: OrderedDict mutated during iteration
cron bug cronjob v14
Avatar
Avatar
1
May 24
8434
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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