Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Odoo v15, Inventory at Date cron job

Subscriure's

Get notified when there's activity on this post

This question has been flagged
cronenterprisereportv15
1 Respondre
4066 Vistes
Avatar
Luis Rodriguez

Is it possible to make a daily cron job for the Inventory->Inventory Report->Inventory at Date action. The idea is to have that report run daily, save it to disk as a CSV and append to it each day. That way I can create a history of the inventory on hand for each day. I can handle the writing and saving the CSV, I just cant seem to figure out what the Inventory at Date action is running and how to be able to call it from a cron job

0
Avatar
Descartar
Avatar
shubham shiroya
Best Answer

Yes, it is possible to schedule a daily cron job to run the "Inventory at Date" action in Odoo and save the report as a CSV file.

you can follow these steps:

  1. Identify the Action: Find the Action associated with the "Inventory at Date" report. You can do this by navigating to the menu item manually and inspecting the action associated with it. Make a note of the action's XML ID.

  2. Create a Python Method: Create a Python method that will be called by the cron job. This method should invoke the action identified in the previous step.

from odoo import models, api

class InventoryReport(models.Model):
_name = 'inventory.report'

@api.model
def generate_inventory_report(self):
action = self.env.ref('module_name.action_id')
# Replace 'module_name.action_id' with the actual XML ID of the action
action.run()

Define the Cron Job: Define a cron job that will execute the Python method on a daily basis. You can do this in the data section of your module's manifest file (__manifest__.py)

depends': ['base'], 

'data': [ 'data/cron_data.xml', ],

Create the Cron Data File: Create a data file (cron_data.xml) in the data directory of your module. This file will define the cron job.

odoo>
data>
record id="ir_cron_generate_inventory_report" model="ir.cron">
field name="name">Generate Inventory Report
field name="model_id" ref="model_inventory_report"/>
field name="state">code
field name="code">model.generate_inventory_report()
field name="interval_number">1
field name="interval_type">days
field name="numbercall">-1
field name="doall" eval="False"/>
field name="active" eval="True"/>
/record>
/data>
/odoo>

  1. Note: Replace model_inventory_report with the actual XML ID of the model where you defined the generate_inventory_report method.

  2. Update the XML ID: Replace 'module_name.action_id' in the Python method with the actual XML ID of the action associated with the "Inventory at Date" report.

  3. Restart the Odoo Server: After making these changes, restart the Odoo server to load the new cron job.


0
Avatar
Descartar
Luis Rodriguez
Autor

Thank you for the answer, it seems like the Inventory at Date button just returns a act_window action and has no run method to it. You can see it here https://github.com/odoo/odoo/blob/15.0/addons/stock/wizard/stock_quantity_history.py

I'm confused as to how the on hand quantities are recalculated based on a simple date context

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Multi language in a legacy qweb report, odoo 15 enterprise.[SOLVED]
qweb enterprise report v15
Avatar
Avatar
1
d’abr. 25
5004
Fedex Shipping Return Label - can I default it to ground when using overnight for delivery?
enterprise v15
Avatar
0
de febr. 24
2566
Remove header from report
report v15
Avatar
Avatar
Avatar
2
de des. 23
3966
How to add custom field on Enterprise reports
enterprise v15
Avatar
Avatar
1
de nov. 23
2991
How to font change of pdf reports(odoo 15) using custom path of fonts. Solved
report v15
Avatar
1
d’oct. 23
8553
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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