Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

[v12] Log Internal Note with action button and wizard

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
wizardloginheritchatternote
5 Replies
12346 Tampilan
Avatar
Cayprol

Hi, I am trying to add a feature to require "Log Note", the internal note logged in the chatter, upon canceling 'stock.picking' record.  
My code to override the original "action_cancel"  
  

def action_cancel(self):
view = self.env.ref('mail.email_compose_message_wizard_form')
wiz = self.env['mail.compose.message'].create({'is_log': True})
_logger.info("Action Cancel is overrided.")
super(Picking, self).action_cancel()
return {
'name': _('Your Reason to Cancel?'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'res_id': wiz.id,
'context': {},
}
  

It opens up the write wizard, but when I hit button 'Log', wizard closes but no note is logged in chatter.
Should I pass anything else through context?  

I already tried    


'context': {'active_model': self._name,
'active_id':self.id}

And also this in context.
    'context': {'default_model': self._name,
'default_res_id':self.id}
0
Avatar
Buang
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Jawaban Terbai

Pass message_type field and it's value ("comment" or "notification") in the context when you return an action.

'default_message_type': 'comment',


3
Avatar
Buang
Cayprol
Penulis

thx for reply, I just tried but still not working.

I also looked into mail_compose_message.py,

line 125: message_type = fields.Selection(default="comment")

I think without default_, on creation, message_type has already been comment.

Sudhir Arya (ERP Harbor Consulting Services)

Try with notification as well in place of comment.

Cayprol
Penulis

It seems like if I pass default_message_type in context regardless the value, the wizard cannot be opened, and caused odoo-server error:

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: Email composition wizard, Operation: create)

is_log = fields.Boolean('Log an Internal Note', help='Whether the message is an internal note (comment mode only)')

Field is_log says it only works in comment mode, I am so lost.

Avatar
Cayprol
Penulis Jawaban Terbai

I finally got it figured out.  For future reference,  

To Log note in the chatter.  There is a built-in function available named "message_post".  

There's no need to directly call the built-in wizard, I can create my own wizard and just write an action to use "message_post".  

"message_post" is available by _inherit = ['mail.thread', 'mail.activity.mixin'], which is needed for the xml form view to display chatter section anyway.  

Example:  

# This method overrides action_cancel and calls my own wizard.
def action_cancel(self):
view = self.env.ref('mymodule.xmlid_of_wizard')
wiz = self.env['action.cancel.confirm'].create({})
_logger.info("Action Cancel is overrided.")
super(Picking, self).action_cancel()
return {
'name': _('Your Reason to Cancel?'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'action.cancel.confirm',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'res_id': wiz.id,
'context': {'parent_model': self._name,
'parent_id': self.id},
}


# Method in the wizard to Log
def action_confirm(self):
parent = self.env[self._context['parent_model']].browse(self._context['parent_id'])
msg = "Log to write"
parent.message_post(body=msg)
1
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
In odoo17.How to synchronize the information to the fields of the new model when chatter log adds new data?
log chatter
Avatar
0
Apr 24
2222
I want person should receive log data every day on his email ,for any record like project task, log notes every day,How its possible?
log chatter
Avatar
0
Des 19
2999
How to add a field to a wizard? Diselesaikan
wizard inherit edit
Avatar
Avatar
1
Mar 15
11360
My old Log Notes are disappearing on SO and PO as the log gets longer
log purchase_order sales.order note
Avatar
0
Apr 24
1528
14E - Track activities changes on chatter
log chatter activities v14
Avatar
Avatar
Avatar
2
Mar 24
3203
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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