İç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

Missing understanding

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
2 Cevaplar
851 Görünümler
Avatar
Bernhard Marx

Hello. I'm trying to understand "what happens where". As I'm unable to modify/ use the default website from the "Recruitment Application" of odoo I'm trying RPC calls.


So when the (default) form is submitted a email is sent, and from the models a "candiate-model" is created. 

Looking at the hr.applicant ("where the form is going to") the is the candiate id mandatory (relation) but I cant see where the candidate (relation) is created.


Using RPC to hr.applicant using the fields the htpp form is also sending I can't create the entity as a relation to "candidate" is missing. Passing an exisiting id as candidate id I also get an error:

message": "The operation cannot be completed: Error, a partner cannot follow twice the same object.",

            "arguments": [

                "The operation cannot be completed: Error, a partner cannot follow twice the same object."

            ],

0
Avatar
Vazgeç
Bernhard Marx
Üretici

Thanks. I understand. But when I pass an exisiting candidate_id I receive:

UniqueViolation: duplicate key value violates unique constraint \"mail_followers_mail_followers_res_partner_res_model_id_uniq\"\nDETAIL:  Key (res_model, res_id, partner_id)=(hr.applicant, 97, 3) already exists.

Christoph Farnleitner

Provide a full example of what you are doing

Avatar
Bernhard Marx
Üretici En İyi Yanıt

Sure

I do this RPC call to  http://odooserver:8069/jsonrpc

{

    "jsonrpc": "2.0",

    "method": "call",

    "params": {

        "service": "object",

        "method": "execute",

        "args": [

            "SLTEST",

            "2",

            "123456789",

            "hr.applicant",

            "create",

            {

                "partner_name": "Harry",

                "email_from": "harry@success.com",

                "partner_phone": "1234567",

                "job_id": 2,

                "department_id": 2,

                "linkedin_profile": "abc",

                "candidate_id": 29

            }

        ]

    },

    "id": 33

}


And I receive


{
    "jsonrpc": "2.0",
    "id": 33,
    "error": {
        "code": 200,
        "message": "Odoo Server Error",
        "data": {
            "name": "odoo.exceptions.ValidationError",
            "debug": "Traceback (most recent call last):\n  File \"/usr/lib/python3/dist-packages/odoo/service/model.py\", line 137, in retrying\n    result = func()\n  File \"/usr/lib/python3/dist-packages/odoo/api.py\", line 517, in call_kw\n    result = getattr(recs, name)(*args, **kwargs)\n  File \"<decorator-gen-315>\", line 2, in create\n  File \"/usr/lib/python3/dist-packages/odoo/api.py\", line 479, in _model_create_multi\n    return create(self, [arg])\n  File \"/usr/lib/python3/dist-packages/odoo/addons/base_automation/models/base_automation.py\", line 774, in create\n    records = create.origin(self.with_env(automations.env), vals_list, **kw)\n  File \"<decorator-gen-289>\", line 2, in create\n  File \"/usr/lib/python3/dist-packages/odoo/api.py\", line 480, in _model_create_multi\n    return create(self, arg)\n  File \"/usr/lib/python3/dist-packages/odoo/addons/hr_recruitment/models/hr_applicant.py\", line 323, in create\n    applicants = super().create(vals_list)\n  File \"<decorator-gen-139>\", line 2, in create\n  File \"/usr/lib/python3/dist-packages/odoo/api.py\", line 480, in _model_create_multi\n    return create(self, arg)\n  File \"/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py\", line 271, in create\n    self.env['mail.followers']._insert_followers(\n  File \"/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_followers.py\", line 417, in _insert_followers\n    sudo_self.create([\n  File \"<decorator-gen-146>\", line 2, in create\n  File \"/usr/lib/python3/dist-packages/odoo/api.py\", line 480, in _model_create_multi\n    return create(self, arg)\n  File \"/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_followers.py\", line 54, in create\n    res = super(Followers, self).create(vals_list)\n  File \"<decorator-gen-31>\", line 2, in create\n  File \"/usr/lib/python3/dist-packages/odoo/api.py\", line 480, in _model_create_multi\n    return create(self, arg)\n  File \"/usr/lib/python3/dist-packages/odoo/models.py\", line 4975, in create\n    records = self._create(data_list)\n  File \"/usr/lib/python3/dist-packages/odoo/models.py\", line 5159, in _create\n    cr.execute(SQL(\n  File \"/usr/lib/python3/dist-packages/odoo/sql_db.py\", line 354, in execute\n    res = self._obj.execute(query, params)\npsycopg2.errors.UniqueViolation: duplicate key value violates unique constraint \"mail_followers_mail_followers_res_partner_res_model_id_uniq\"\nDETAIL:  Key (res_model, res_id, partner_id)=(hr.applicant, 98, 3) already exists.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 2386, in __call__\n    response = request._serve_nodb()\n  File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 1858, in _serve_nodb\n    response = self.dispatcher.dispatch(rule.endpoint, args)\n  File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 2178, in dispatch\n    result = endpoint(**self.request.params)\n  File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 727, in route_wrapper\n    result = endpoint(self, *args, **params_ok)\n  File \"/usr/lib/python3/dist-packages/odoo/addons/base/controllers/rpc.py\", line 178, in jsonrpc\n    return dispatch_rpc(service, method, args)\n  File \"/usr/lib/python3/dist-packages/odoo/http.py\", line 398, in dispatch_rpc\n    return dispatch(method, params)\n  File \"/usr/lib/python3/dist-packages/odoo/service/model.py\", line 37, in dispatch\n    res = execute(db, uid, *params[3:])\n  File \"/usr/lib/python3/dist-packages/odoo/service/model.py\", line 68, in execute\n    res = execute_cr(cr, uid, obj, method, *args, **kw)\n  File \"/usr/lib/python3/dist-packages/odoo/service/model.py\", line 52, in execute_cr\n    result = retrying(partial(odoo.api.call_kw, recs, method, args, kw), env)\n  File \"/usr/lib/python3/dist-packages/odoo/service/model.py\", line 156, in retrying\n    raise _as_validation_error(env, exc) from exc\nodoo.exceptions.ValidationError: The operation cannot be completed: Error, a partner cannot follow twice the same object.\n",
            "message": "The operation cannot be completed: Error, a partner cannot follow twice the same object.",
            "arguments": [
                "The operation cannot be completed: Error, a partner cannot follow twice the same object."
            ],
            "context": {}
        }
    }
}


​

0
Avatar
Vazgeç
Avatar
Christoph Farnleitner
En İyi Yanıt

candidate_id on hr.applicant is defined here:

https://github.com/odoo/odoo/blob/18.0/addons/hr_recruitment/models/hr_applicant.py#L39


Now, when taking a look at the website form for applying to a job, https://github.com/odoo/odoo/blob/18.0/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml#L206, you can see that Odoo uses a generic form action (/website/form/) to post data to; Thus, the route for it is defined here: https://github.com/odoo/odoo/blob/18.0/addons/website/controllers/form.py.

Now, investigating it further you'll come across a call to _handle_website_form() (line 65 as of today) which does some extract_data() shenanigans.

This extract_data() is then extended in the website specific module for HR Recruitment (https://github.com/odoo/odoo/blob/18.0/addons/website_hr_recruitment/controllers/main.py#L349) in which you then can find the actual creation of such a candidate, based on the form data:

if partner_phone and partner_email:
candidate = request.env['hr.candidate'].sudo().search([
    ('email_from', '=', partner_email),
        ('partner_phone', '=', partner_phone),
    ], limit=1)
if not candidate:
candidate = request.env['hr.candidate'].sudo().create({
    'partner_name': partner_name,
        'email_from': partner_email,
        'partner_phone': partner_phone,
        'company_id': company_id,
})

and finally, a little further down the line, the candidate_id is passed on for using it in the actual hr.applicant record:

if candidate:
data['record']['candidate_id'] = candidate.id



0
Avatar
Vazgeç
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
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