Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

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

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
croncronjob
3 Replies
12875 Rodiniai
Portretas
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
Portretas
Atmesti
Jainesh Shah(Aktiv Software)

Can you please add your scheduler code.

Gagea Alexandru
Autorius

<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>

Portretas
Gagea Alexandru
Autorius Best Answer

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
Portretas
Atmesti
Mahmoud

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

Portretas
Adil Akbar
Best Answer

Hi, you can follow this link for this:

https://youtu.be/iBvtwy8x_E0

Hope it helps,

Thanks

0
Portretas
Atmesti
Portretas
Prakash
Best Answer


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
Portretas
Atmesti
Gagea Alexandru
Autorius

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!

Registracija
Related Posts Replies Rodiniai Veikla
Using CRON job to download and attach pdf to binary field ODOO16
cron cronjob ODOO16
Portretas
0
spal. 24
3125
Cron getting timeout
cron timeout cronjob
Portretas
Portretas
1
rugp. 24
6177
How can i run a single auto scheduler in Odoo for multiple users at the same time?
cron scheduler cronjob
Portretas
0
geg. 21
4624
Cron Job issue
cron nginx cronjob AttributeError
Portretas
Portretas
Portretas
Portretas
3
rugs. 25
4158
Cron job showing error: RuntimeError: OrderedDict mutated during iteration
cron bug cronjob v14
Portretas
Portretas
1
geg. 24
8504
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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