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

Reload or refresh the page/form on field change

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
codeformrefreshreloadodoo16features
2 Replies
10515 Tampilan
Avatar
Paolo Franchi

Hello, I am working with Odoo 16, and I was wondering if there is a way to update the entire web page, or to reload just the form view, when a field in the form changes (in my specific case, a Many2one field called "bank").

I'm asking this because I have a "documents" One2many field, in the same form where "bank" is, that automatically updates when "bank" changes.
In the Python method, decorated with @api.onchange('bank'), there are instructions that create documents in the database based on the selected bank.
The issue is that if I change "bank", after manually adding a document, the new documents created by the function are not displayed until I save the form or reload the page.


I tried using JavaScript, writing the following snippet:

odoo.define('my_crm.reload_on_bank_change', function (require) {
"use strict";

var FormController = require('web.FormController');

FormController.include({
_onFieldChanged: function (record, changes) {
if ('bank' in changes) {
// Reload the page if the "bank" field has changed
location.reload(true);
}
},
});
});

And also Python, using @api.onchange('bank') on my method and making it return the following:

return {
    'type': 'ir.actions.client',
    'tag': 'reload',
}


I have searched everywhere online and in the documentation, but I haven't been able to find a solution, and unfortunately, the above methods didn't work.
Thanks to anyone who will answer.

0
Avatar
Buang
Avatar
Tran Van Minh
Jawaban Terbai
 bus_service.subscribe is not function. How to fix?
0
Avatar
Buang
Avatar
odooUser
Jawaban Terbai

try this
at the end of python method:

self.env['bus.bus']._sendone(self.create_uid.partner_id, 'page_refresh', {
'type': response_type,
'title': "Reload",
'message': _(response_message),
'sticky': True,
'model_name': self._name,
'rec_id': self.id
})

in js:

=/* @odoo-module */

import { registry } from "@web/core/registry";
import { browser } from "@web/core/browser/browser";

export const simplePageRefresh = {
dependencies: ["bus_service", "notification"],
start(env, { bus_service, notification: notificationService }) {
bus_service.subscribe("page_refresh", ({ message, sticky, title, type, model_name, rec_id }) => {

if (`${browser.location}`.includes(`id=${rec_id}`) && `${browser.location}`.includes(`model=${model_name}`)) {
browser.location.reload();
} else {
console.log('cant locate correct page');
}

notificationService.add(message, { sticky, title, type });
});
bus_service.start();
},
};

registry.category("services").add("refresh_page", simplePageRefresh);


0
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
How to override FormController method?
form odoo16features
Avatar
Avatar
1
Apr 24
3454
Button in all modules
form odoo16features
Avatar
Avatar
Avatar
3
Jun 23
3262
odoo 16 method that can be overriden when a form opens
form view odoo16features
Avatar
Avatar
1
Mei 24
2418
Send an email automatically
mail form odoo16features
Avatar
1
Sep 23
3000
Reset some fields in a form to default value
form reset odoo16features
Avatar
Avatar
1
Jun 23
4507
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