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
    Supply Chain
    • 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
    • Discuss
    • Kecerdasan Buatan
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • 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
    • Manajemen Properti
    • 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
    • Konsultasi
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan
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

Onchange y self.env.company not work

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
invoicemexicoodoo16features
2 Replies
2750 Tampilan
Avatar
Manuel Garcia

Hello, I have a problem with the onchange event that is not working completely in multi-company. The instruction self.env.company is not returning the current company. Can you help me identify what could be failing, if there is any solution or if it is an Odoo bug that needs to be fixed. The problem had not arisen until multiple companies with different RFCs began to be used. The restriction validates that the mx_customer_rfc field is the same as the company’s. So the problem is that self.env.company always returns the same company regardless of whether the user is moving from company to company. What I identified is that outside of onchange it does work, it is even the classic way to assign the default company (default=lambda self:self.env.company).


@api.constrains('mx_customer_rfc')
def _check_customer_rfc(self):
for record in self:
if record.mx_customer_rfc and record.mx_customer_rfc != self.env.company.vat and (record.move_type == 'in_invoice' or record.move_type == 'in_refund' or record.move_type == 'in_receipt'):
raise ValidationError('El RFC del receptor (%s) no corresponde con el RFC de %s (%s)' %
(record.mx_customer_rfc, self.env.company.name, self.env.company.vat))



0
Avatar
Buang
Manuel Garcia
Penulis

@Niyas Raphy
Hi,
Yes, it’s correct, you have multi-company mode enabled and several companies selected in the company switcher, that is, in the menu bar, and you understand that self.env.company will return the first selected company. However, when using @api.constrains for some strange reason it no longer works, it always returns the same company regardless of whether you are switching between companies from the menu bar.

Thanks

Avatar
Manuel Garcia
Penulis Jawaban Terbai

@Niyas Raphy

Hi,
Yes, it’s correct, you have multi-company mode enabled and several companies selected in the company switcher, that is, in the menu bar, and you understand that self.env.company will return the first selected company. However, when using @api.constrains for some strange reason it no longer works, it always returns the same company regardless of whether you are switching between companies from the menu bar.

Thanks


0
Avatar
Buang
Avatar
Niyas Raphy (Walnut Software Solutions)
Jawaban Terbai

Hi,
If you have multi company enabled and multiple companies selected in the company switched, ie, in the menu bar, self.env.company will return the first select company .

And this will return the selected company properly, can you confirm that are you looking for the same or you are looking for the company selected in the record ?

If you need to check with company set in the record, use self.company_id instead of self.env.company

Thanks

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
Add bank account number under company details of a invoice - Odoo 16 Community Edition Diselesaikan
invoice odoo16features
Avatar
Avatar
1
Mar 24
1476
How to place a foreach loop inside a <td> in a QWEB Report Diselesaikan
invoice odoo16features
Avatar
Avatar
1
Jul 23
4886
How to place a foreach loop inside a <td> in a QWEB Report
invoice odoo16features
Avatar
0
Jul 23
25
Link Invoice and Sale order In Odoo 16.4
invoice sales.order odoo16features
Avatar
Avatar
1
Des 24
4106
Odoo 16. Report same report has two different faces.
invoice reports odoo16features
Avatar
Avatar
1
Des 23
3838
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
  • Karir
  • 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo adalah software terintegrasi dengan 70+ aplikasi seperti CRM, Akuntansi, Inventaris, Sales, eCommerce, Marketing, POS; plus fitur lokal Indonesia!

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