Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

How make a domain based on today date.

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
odooDomain
3 Besvarelser
7093 Visninger
Avatar
Abdul Qoudouss

Hello every one. Please, can someone helps me ? i created automate actions based on time condition which is at the next date of preventive maintenance. This automate actions is permit to create a record. But it seems that, this automate actions not worked at this specifically date. so i want to put a domain in order to works at the next date of preventive maintenance which is will be compared to the today date. How do i handle this ? Please.

i make this in domain [["next_action_date","=",context_today()]] but i got error

0
Avatar
Kassér
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Bedste svar

Hi,

First of all: we cannot provide the domain like you have given.
Currently, It is not possible to set a dynamic domain for the date field in the domain filter.
But, It doesn't matter. You can do it easily with the python code.
If you need to create the maintenance request for the equipments by just comparing the Date of the next preventive maintenance(next_action_date) with current date, you can do it using a scheduled action with code given below(Model: maintenance.equipment, Execute Every: 1 Days):

utc_date_now = datetime.datetime.now()
user_date_now = utc_date_now.astimezone(timezone(user.tz)).date()
equipments_for_maintenance = model.sudo().search([('next_action_date', '=', user_date_now)])
for equipment in equipments_for_maintenance:
env['maintenance.request'].create({
'name': 'Preventive Maintenance - ' + equipment.name,
'equipment_id': equipment.id,
'maintenance_type': 'preventive',
'request_date': equipment.next_action_date,
'schedule_date': equipment.next_action_date,
'duration': record.maintenance_duration
# add the values to the fields in 'maintenance.request'
})

If you need to do the same when we create/ update the Date of the next preventive maintenance(next_action_date), you can create an automated action with the code given below(Model: maintenance.equipment, Trigger: On Creation & Update, Trigger Fields: Date of the next preventive maintenance, Before Update Domain: [], Apply on: [], Action To Do: Execute Python Code):

utc_date_now = datetime.datetime.now()
user_date_now = utc_date_now.astimezone(timezone(user.tz)).date()
if records:
for record in records:
if record.next_action_date == user_date_now:
env['maintenance.request'].create({
'name': 'Preventive Maintenance - ' + record.name,
'equipment_id': record.id,
'maintenance_type': 'preventive',
'request_date': record.next_action_date,
'schedule_date': record.next_action_date,
'duration': record.maintenance_duration
# add the values to the fields in 'maintenance.request'
})





Regards

0
Avatar
Kassér
Abdul Qoudouss
Forfatter

Thanks a lot . I realy appreciate. But in m'y case , i create automate action whish create request maintenance at the date of thé next préventive maintenance because Odoo generates New request maintenance all Times. So i don't understand the reason. If u Can explain to me, the scheduled action of Odoo on the preventive request maintenance whish is implanted on the System by défault. Thanks very much

Cybrosys Techno Solutions Pvt.Ltd

The function _cron_generate_requests() is used with the scheduled action(Maintenance: generate preventive maintenance requests) in which the equipments are searched with the domain [('period', '>', 0)]. Then for those equipments, Odoo checks existing maintenance requests, where the maintenance type is 'Preventive', the request is created for the given equipment, the stage of request is not a completed stage, and the request date is the Date of the next preventive maintenance of the equipment. If there is no existing maintenance request, a new one is created using the method: _create_new_request(equipment.next_action_date).
That is, the default scheduled action of Odoo creates maintenance requests for all the maintenance equipment where the Preventive Maintenance Frequency or Days between each preventive maintenance(period) is greater than 0. It doesn't compare the Date of the next preventive maintenance with the current date.
Note: If you are adding the scheduled action or the automated action given here(don't add both), please disable the default one.

Abdul Qoudouss
Forfatter

Thanks a lot ! i really appreciate ur assistance. It is now, very clear !

Avatar
Abdul Qoudouss
Forfatter Bedste svar

See.


0
Avatar
Kassér
Avatar
Pratyush Ratan
Bedste svar

Hey, 

You can try this one,

[('next_action_date','=',fields.Date.today())]

0
Avatar
Kassér
Abdul Qoudouss
Forfatter

Thanks for ur support. but its not worked. I use Odoo online so i have to make a domain by interface user.
I'll share u pic. Thanks

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

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
IOT Box URL Changing Løst
odoo Domain iot
Avatar
Avatar
2
maj 21
6296
(!!C-o-p-a!!)¿Cómo comunicarse con Copa Airlines en Panamá?
odoo
Avatar
0
nov. 25
211
How do I go about this error? I am trying to uninstall a module
odoo
Avatar
0
nov. 25
3331
(#iberia#)¿Cómo llamar a Iberia desde Panamá?
odoo
Avatar
0
okt. 25
399
How to import product variants with my own external id when using dynamic creation mode Løst
odoo
Avatar
Avatar
2
aug. 25
3902
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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