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 16: how to create a new record in custom model (table)?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
activityodoo16features
1 Respondre
4608 Vistes
Avatar
SmithJohn45

when user MARK AS DONE or DONE & SCHEDULE NEXT a Schedule Activity i want to create a record in a custom model (table) through functions in mail.activity.


function name is action_done and action_done_schedule_next, if it success then required record should be created with below mentioned attributes from mail.activity.   i want it because when a user marked activity as DONE, Odoo delete from activity and i want to check it, if its DONE then create next default sheduled activity. (if you have a better idea, please advise)


the fields required from mail.activity are: (please add fields which required necessarily for activity marked as DONE)

id, res_id, res_model, summary, write_date


my custom model (table) 'mail_activity_done' contains fields:

ma_id, ma_res_id, ma_res_model, ma_summary, ma_write_date


all types of DONE activity will be recorded here for later use.


regards


0
Avatar
Descartar
Avatar
Karan BK
Best Answer

You can override the _action_done method which is a common method called whenever from action_done and action_done_schedule_next as follows


Adjust the field names and data stored in them as per your implementation.


Automated action to create record:


Regards,

Karan BK

1
Avatar
Descartar
SmithJohn45
Autor

thank you @Karan , but i am restricted to customize through Odoo frontend only, i am not allowed to add a custom module to do this. how to achieve this through Odoo frontend in Developer mode using Settings -> Technical?

regards

Karan BK

Okay, in that case you can use an automated action which will be triggered whenever an activity is deleted. One limitation of this approach is since there is no way of knowing whether activity was deleted manually or by system when it was marked as done, it will create new record for all activitives.

I have updated the answer to include automated action. See if this is something you can work with.

SmithJohn45
Autor

thank you very much for your concerns, highly appreciated for your help. will check it how it can be beneficial.

as mentioned in my opening post, main reason is to create Next Schedule Activity when user 'mark as done' or 'done & schedule next' . the same problem is here when a record deleted i don't know if its actually Done or something else? if you have any solution for this problem, please guide.

regards

tang

Hello karan,
do you know what method will be triggered when the user clicks cancel? Now I have written the corresponding method in unlink, but there is an obvious problem: if the user clicks MARK AS DONE, my method will also be triggered. Looking forward to your reply

SmithJohn45
Autor

@tang you should create new topic, as this one is marked Answer so rare chance a senior can visit to Answer.

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
odoo 16: inherit & add field in CRM Activity Mark Done tiny popup view
activity odoo16features
Avatar
Avatar
1
d’ag. 23
3062
odoo16: filter with List of distinct Mobile numbers to select
filter activity odoo16features
Avatar
1
de set. 23
2547
CRM - activities should be created for today's date by default instead of next day
leads activity odoo16features
Avatar
1
d’ag. 23
2841
ValueError: <class 'psycopg2.ProgrammingError'>: "can't adapt type 'mail.activity.type'" Solved
activity AutomatedActions odoo16features
Avatar
1
d’ag. 23
3742
ValueError: [class 'psycopg2.ProgrammingError']: "can't adapt type 'ir.model'" while evaluating Solved
activity AutomatedActions odoo16features
Avatar
Avatar
1
d’ag. 23
4509
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