İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Problem with variable in domain

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
domainpartner_idcrm.lead
3 Cevaplar
6973 Görünümler
Avatar
Théo Da silva

Hi!

I would like to add a button in contact that will link to crm.lead that the contact sold.

Because of the crm.lead salesman is link by a user_id I created a computed many2one field (stored) crm_user_id to the linked user:

record.crm_user_id = self.env['res.users'].search([('partner_id', '=', record.id)]).id

The id is right but when I want to use it for the domain I get this error:

 

Uncaught Error: NameError: name 'crm_user_id' is not defined
http://localhost:8069/web/content/654-6128a20/web.assets_backend.js:145 Traceback: Error: NameError: name 'crm_user_id' is not defined


When I set a fixe value like 2 (the id of one on my user) instead of the var crm_user_id It works perfectly

The domain in question is set like that:


    <record model="ir.actions.act_window" id="crm_open">
        <field name="domain">[('user_id', '=', crm_user_id)]</field>
        <field name="name">CRM</field>
        <field name="res_model">crm.lead</field>
    </record>


0
Avatar
Vazgeç
Avatar
Anisha Bahukhandi
En İyi Yanıt

Hello Théo Da Silva, 

You are getting this issue because "crm_user_id" is not defined inside the windows action and by default in Odoo you can't pass value in domain inside a XML file for windows action.

And your requirement is to show leads from Partner on button click

So instead of creating a computed field inside the partner you can achieve the same using button method. 

def action_open_crm_lead(self):
        self.ensure_one()
        userObjs = self.env['res.users'].search([('partner_id', '=', self.id)], limit=1)
        user_id = userObjs.id if userObjs else False
        domain = [('user_id', '=', user_id)] if user_id else []
        return {
            'name': 'CRM LEAD',
            'domain': domain,
            'res_model': 'crm.lead',
            'type': 'ir.actions.act_window',
            'view_mode': 'tree,form',
            'view_id': False,
        }

Feel free to ask your queries

Thanks

Anisha Bahukhandi

3
Avatar
Vazgeç
Avatar
Mustufa Rangwala
En İyi Yanıt

Hello,

Can you please make sure you have store=True on "crm_user_id" field which you have created on contact  (res.partner) form. ?

Regards,

Mustufa Rangwala (Probuse)

0
Avatar
Vazgeç
Avatar
Théo Da silva
Üretici En İyi Yanıt

Hello Mustufa,

Thanks for your answer, yes store=True

    crm_user_id = fields.Many2one(
        comodel_name='res.users',
        compute=_compute_crm_user_id,
        store=True)

I also have a value in the postgres at the field crm_user_id in the table res_patner.

But I still get the same error

Edit:

Thank you very much Anisha Bahukhandi it works perfectly

0
Avatar
Vazgeç
Anisha Bahukhandi

Hello Théo Da Silva,

It's great that your query is resolved and you are satisfied with my assistance.

I would really appreciate if you can take out a few minutes out of your busy schedule and put a google review for me here -

https://www.google.com/search?q=webkul&oq=webkul+&aqs=chrome..69i57j69i60l3j0l2.4182j0j7&sourceid=chrome&ie=UTF-8#lrd=0x390ce561c5555555:0xcfb40ae166ce6c21,1,

A nice review from your side will motivate me and my team to provide exceptional assistance.

I hope you can manage to provide few minutes for this :)

Regards

Anisha Bahukhandi

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

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Get the partner_id of a user for window action domains Çözüldü
domain partner_id window_action
Avatar
Avatar
1
Nis 18
8712
Is it possible to filter by partner_id of the current user?
filter domain partner_id uid
Avatar
0
Eki 23
2480
Filter products based on partner order history
domain sale.order partner_id product.product
Avatar
Avatar
1
Eyl 21
2138
How to modify the list display fields of crm.lead in Odoo 17 Community Edition?
crm.lead
Avatar
Avatar
Avatar
2
Ağu 25
3330
naked domain set up Çözüldü
domain
Avatar
Avatar
Avatar
Avatar
3
Tem 25
6081
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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