تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (BI)
    • المستندات
    • توقيع إلكتروني
    المبيعات
    • إدارة علاقات العملاء
    • المبيعات
    • نقطة البيع للمتاجر
    • نقطة البيع للمطاعم
    • الاشتراكات
    • تأجير
    المواقع الإلكترونية
    • أداة بناء المواقع الإلكترونية
    • متاجر إلكترونية
    • مدونة
    • المنتدى
    • دردشة مباشرة
    • التعليم الإلكتروني
    سلسلة التوريد
    • المستودعات
    • التصنيع
    • إدارة دورة حياة المنتج
    • المشتريات
    • الصيانة
    • الجودة
    الموارد البشرية
    • موظفون
    • التوظيف
    • إجازة عمل
    • التقييمات
    • الإحالات
    • تطبيق الأسطول
    التسويق
    • التسويق الإجتماعي
    • التسويق عبر البريد الإلكتروني
    • التسويق عبر الرسائل النصية
    • فعاليات
    • أتمتة التسويق
    • الاستطلاعات
    الخدمات
    • المشاريع
    • الجداول الزمنية
    • الخدمة الميدانية
    • مكتب المساعدة
    • التخطيط
    • مواعيد
    اﻹنتاجية
    • مناقشة
    • الموافقات
    • إنترنت الأشياء "IoT"
    • بروتوكول ربط المحادثات الصوتية عبر الإنترنت
    • المعرفة
    • WhatsApp
    التطبيقات الخارجية ستوديو أودو منصة أودو السحابية
  • قطاعات الأعمال
    البيع بالتجزئة
    • متجر كتب
    • متجر ملابس
    • متجر أثاث
    • متجر بقالة
    • متجر معدات
    • متجر ألعاب
    الطعام والضيافة
    • بار وحانة
    • المطعم
    • مطعم للوجبات السريعة
    • نزل للضيوف
    • موزّع مشروبات
    • فندق
    العقارات
    • وكالة عقارات
    • شركة هندسة معمارية
    • البناء
    • إدارة العقارات
    • العناية بالحدائق
    • اتحاد مُلاّك العقارات
    استشارة
    • مؤسسة محاسبية
    • شريك أودو
    • وكالة تسويقية
    • منشأة قانونية
    • استقطاب المواهب
    • التدقيق والتوثيق
    التصنيع
    • الأقمشة
    • معدني
    • الأثاث
    • الطعام
    • مصنع خمور
    • هدايا الشركات
    الصحة واللياقة البدنية
    • نادي رياضي
    • متجر نظارات
    • مركز لياقة بدنية
    • الممارسون الصحيون
    • صيدلية
    • صالون تصفيف الشعر
    التجارة
    • عامل صيانة
    • الأجهزة والمعدات التقنية ودعمها
    • أنظمة الطاقة الشمسية
    • صانع أحذية
    • خدمات التنظيف
    • خدمات التكييف (HVAC)
    غير ذلك
    • منظمة غير ربحية
    • وكالة بيئية
    • تأجير لوحات إعلانية
    • تصوير
    • تأجير دراجات
    • بائع وسيط للبرمجيات
    تصفح كافة قطاعات الأعمال
  • مجتمع أودو
    تعلم
    • دروس
    • التوثيق
    • شهادات
    • التدريب
    • مدونة
    • بودكاست
    قم بتعزيز التعليم
    • برنامج تعليم
    • Scale UP! لعبة الأعمال
    • قم بزيارة أودو
    احصل على البرنامج
    • تحميل
    • قارنْ الإصدارات
    • إطلاق
    تعاون
    • جيت هاب "Github"
    • المنتدى
    • فعاليات
    • الترجمات
    • كنْ شريكاً
    • خدمات الشركاء
    • سجل مكتب المحاسبة الخاص بك
    احصل على الخدمات
    • اعثر على شريك
    • اعثر على محاسب
    • قابل أحد مرشدي الأعمال
    • خدمات التنفيذ
    • مراجع العملاء
    • الدعم
    • الترقيات
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    الحصول على عرض توضيحي
  • الأسعار
  • المساعدة

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

  • إدارة علاقات العملاء
  • e-Commerce
  • المحاسبة
  • المخزون
  • PoS
  • المشروع
  • MRP
All apps
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
المساعدة

AttributeError: '_unknown' object has no attribute 'id'

اشتراك

تسلم الإشعارات عندما يكون هناك نشاط في هذا المنشور

لقد تم الإبلاغ عن هذا السؤال
errorhelpunknowncustom_module
1 الرد
8487 أدوات العرض
الصورة الرمزية
Hugues Perrier

Hello, 

I'm on odoo 15 and I'm trying to create a custom module, but I have an error that I can't fix:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 687, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 910, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1326, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1318, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 6507, in onchange
result['value'] = snapshot1.diff(snapshot0, force=first_call)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 6331, in diff
result[name] = field.convert_to_onchange(self[name], record, {})
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 2845, in convert_to_onchange
return super().convert_to_onchange(value._origin, record, names)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 868, in convert_to_onchange
return self.convert_to_read(value, record)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 2821, in convert_to_read
return value.id
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
AttributeError: '_unknown' object has no attribute 'id'

Here is the model : 

from email.policy import default
from odoo import models, fields, api, tools
from odoo.tools import date_utils, email_re, email_split, is_html_empty
from odoo.addons.phone_validation.tools import phone_validation
from datetime import date, datetime, timedelta

class WeglioProspect(models.Model):
# ---------------------------------------- Private Attributes ---------------------------------

_name = "weglio.prospect"
_description = "School prospection by Weglio"

# --------------------------------------- Fields Declaration ----------------------------------

prospect_note = fields.Html("Annotation prospect")
admission_step = fields.Selection([
('nouveau', 'Nouveau'),
('relancer', 'Relancer'),
('refusé', 'Refusé'),
('reporté', 'Reporté'),
('session d’admission', 'Session d’admission'),
('absent en session d’admission', 'Absent en session d’admission'),
('coaching', 'Coaching'),
('admis', 'Admis'),
('eleve', 'Eleve')], "Etape d'admission", required=True, default='nouveau')

# ---------------------------------------------- Contact information need to copy in contact module ------------------------------------------------
civility = fields.Selection([
('monsieur', 'Monsieur'),
('madame', 'Madame'),
('autre', 'Autres')], "Civilité", track_visibility='onchange')
name = fields.Char(required=True)
email = fields.Char("Mail", required=True)
phone = fields.Char("Téléphone", required=True)
# ------------------- Adresse ---------------------
street = fields.Char() # "Adresse"
city = fields.Char() # "Ville"
zip = fields.Char() # "Code Postal"
country_id = fields.Many2one('res.country') # "Pays"
# ------------------- Info naissance ---------------------
date_birth = fields.Date("Date de naissance")
city_birth = fields.Char("Ville de naissance")
country_birth = fields.Many2one('res.country', 'Pays de naissance')

# ---------------------------- Info ----------------------------
source_id = fields.Many2one('utm.source', "Source")
nationality = fields.Many2one('res.country', 'Nationalité')
vital_card = fields.Char("Carte Vital", track_visibility='onchange')
social_system = fields.Selection([('urssaf', 'URSSAF'),
('msa', 'MSA')], 'Régime social')
sport = fields.Selection([('oui', 'Oui'),
('non', 'Non')], 'Sportif')
handicap = fields.Selection([('oui', 'Oui'),
('non', 'Non')], 'Handicape')
situation_before = fields.Selection([('scolaire', 'Scolaire'),
('prepa', 'Prépa'),
('apprentissage', 'Apprentissage'),
('etudiant', 'Etudiant'),
('contrat apprentissage', 'Contrat d\'apprentissage'),
('contrat de professionnalisation', 'Contrat de professionnalisation'),
('contrat aide', 'Contrat aidé'),
('cfa avant signature contrat apprentissage',
'CFA avant signature d\'un contrat d\'apprentissage'),
(
'cfa sans contrat suite à une rupture', 'CFA sans contrat suite à une rupture'),
('stagiaire formation professionnelle', 'Stagiaire formation professionnelle'),
('salarie', 'Salarié'),
('recherche un emploi', 'recherche d\'un emploi'),
('inactif', 'Inactif')], 'Situation avant') # voir avec Guillaume
last_degree = fields.Char('Dernier diplôme préparé')
last_class = fields.Char('Derniere classe') # voir avec Guillaume
# ------------------- Info suivi ---------------------
date_last_raise = fields.Date('Dernière relance')
count_last_raise = fields.Integer('Nombre de relance', compute="_compute_raise_date")

date_previous_raise = fields.Date('Dernière relance')
count_previous_raise = fields.Integer('Nombre de relance')

active = fields.Boolean(string='Actif', default=True)
# ------------------- Document ---------------------
curriculum = fields.Binary("CV", help="Déposer votre cv")
cv_name = fields.Char(compute="_compute_cv_name") # Nom du fichier upload

motivation_letter = fields.Binary("Lettre de motivation", help="Déposer votre lettre de motivation")
motivation_name = fields.Char(compute="_compute_motivation_letter_name") # Nom du fichier upload

upload_test = fields.Binary("Test d'admission", help="Déposer votre test d'admission")
upload_admission_file = fields.Binary("Dossier d'admission", help="Déposer votre Dossier d'admission")
# ------------------- Après être admis ---------------------
company_status = fields.Selection([
('avec entreprise', 'Avec entreprise'),
('a placer en entreprise', 'A placer en entreprise'),
('doit trouver une entreprise', 'Doit trouver une entreprise')], "Status d'admission entreprise")
contract_status = fields.Selection([
('contrat en cours', 'Contrat en cours'),
('interruption contrat', 'Interruption contrat'),
('stagiaire de la formation', 'Stagiaire de la formation')], "Status du contrat")
# Faire la vue des champs ci-dessous

admission_file_complet = fields.Boolean()
wait_doc = fields.Boolean()

# ------------------------- Fields Other Module Declaration ---------------------------

# Permet de définir si la liste affiche uniquement les leads ou les entreprises
company_id = fields.Many2one('res.company', string='Entreprise', domain=[('is_company', '=', True)])
formation_id = fields.Many2one('weglio.formation', string='Formation souhaité')
partner_id = fields.Many2one('res.partner', string='Nom, Prenom', domain=[('is_company', '=', False)])
# domain permet de preselectionner entreprise lors de la création de celle ci
session_re_ids = fields.Many2many('calendar.event', 'weglio_prospect_event_1_rel', 'id', 'event_id', string="Recrutement", domain="[('session_type', '=', 'recrutement')]")
session_co_ids = fields.Many2many('calendar.event', 'weglio_prospect_event_2_rel', 'id', 'event_id', string="Coaching", domain="[('session_type', '=', 'coaching')]")

recrutement_names = fields.Char(string="Recrutement", compute="_compute_session_re_ids_names")
coaching_names = fields.Char(string="Coaching", compute="_compute_session_co_ids_names")

# ------------------------------------- Statistique ----------------------------------------------
# ------------------------------------- Onchange simple ----------------------------------------------
def _onchange_company(self):
if self.admission_step != "admis":
self.company_status = ""
self.company_id = ""

@api.onchange("admission_file_complet", "admission_step")
def _onchange_admssion(self):
if self.admission_file_complet:
self.admission_step = "admis"

# ------------------------------------- Compute simple ----------------------------------------------

@api.depends('session_re_ids')
def _compute_session_re_ids_names(self):
for prospect in self:
prospect.recrutement_names = ', '.join(prospect.session_re_ids.mapped('name'))

@api.depends('session_co_ids')
def _compute_session_co_ids_names(self):
for prospect in self:
prospect.coaching_names = ', '.join(prospect.session_co_ids.mapped('name'))

@api.depends('cv_name', 'partner_id', 'curriculum')
def _compute_cv_name(self):
if self.curriculum:
for each in self:
each.cv_name = "CV_" + each.partner_id.name
else:
self.cv_name = ""

@api.depends('motivation_name', 'partner_id', 'motivation_letter')
def _compute_motivation_letter_name(self):
if self.motivation_letter:
for each in self:
each.motivation_name = "motivation_letter_" + each.partner_id.name
else:
self.motivation_name = ""

@api.depends('partner_id')
def _compute_contact_to_name(self):
if self.name != "":
for each in self:
each.name = "Opportunité : " + each.partner_id.name
else:
each.name = "Opportunité : Anonyme"

@api.onchange('date_last_raise')
def onchange_date_derniere_relance(self):
if self.date_last_raise:
self.admission_step = 'relancer'

# Permet l'archivage des leads
def toggle_archive(self):
for record in self:
record.is_archived = not record.is_archived

# Permet +1 le nombre de relance
@api.depends('date_last_raise', 'count_last_raise')
def _compute_relance_date(self):
for record in self:
if record.date_last_raise != record.date_previous_relance:
record.count_last_raise = record.count_previous_raise + 1
else:
record.count_last_raise = record.count_previous_raise

record.date_previous_raise = record.date_last_raise
record.count_previous_raise = record.count_last_raise


If anyone has an idea, I'm a taker.
Best regards

0
الصورة الرمزية
إهمال
Hugues Perrier
الكاتب

Hello, 

Thank you very much for your help, I found the cause. It's the source_id variable that causes a problem, I think it's because I didn't import the corresponding module in the manifest.py

Or I made a mistake here : source_id = fields.Many2one('utm.source', "Source")

Have a nice day :)

الصورة الرمزية
Cybrosys Techno Solutions Pvt.Ltd
أفضل إجابة

There are several reasons to get the error “unknown object has no attribute id

->If we add a many2one field , for example

product_id = fields.Many2one(‘product.product’ string=’Product’)

But we didn’t add ‘product’ on 'depends' in the manifest file,and then we got the error.

->If define a Many2one field without a model, ie, for example

Product_id = fields.Many2one(string=’Product’)

->When we pass wrong data types , for example

field_name = fields.Many2one('partner_id.phone', string=’ Number', readonly=True)

Here the field phone is a Char field , but we give the field type is Many2one

1
الصورة الرمزية
إهمال
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!

أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
Can't change default value of a Custom Model
error default custom_module
الصورة الرمزية
0
مارس 25
1347
Issue on Account move lline
error help account.move.line
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
ديسمبر 23
6808
Module creation issues for v17
development developement error help
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
يونيو 24
3427
Configure the Outgoing Mail Servers: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1007)
error email help configure
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
يونيو 24
3068
Error Upgrade Odoo version 12 to version 16 تم الحل
error help odooV12 odoo16features
الصورة الرمزية
الصورة الرمزية
1
يوليو 23
3317
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "Github"
  • المشغل الآلي رنبوت
  • الترجمات
خدماتنا
  • استضافة أودو إس إتش
  • الدعم
  • الترقية
  • التطويرات المخصصة
  • التعليم
  • اعثر على محاسب
  • اعثر على شريك
  • كنْ شريكاً
معلومات عنا
  • شركتنا
  • أصول العلامة التجارية
  • اتصلْ بنا
  • الوظائف
  • فعاليات
  • بودكاست
  • مدونة
  • عملاء
  • قانوني • الخصوصية
  • الحماية
الْعَرَبيّة 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

أودو هو عبارة عن مجموعة من تطبيقات الأعمال مفتوحة المصدر التي تغطي جميع احتياجات شركتك، مثل: إدارة علاقات العملاء والتجارة الإلكترونية والمحاسبة والمخزون ونقاط البيع وإدارة المشاريع وما إلى ذلك.

ما يجعل من أودو مميزاً هو هدفه بأن يكون سهل الاستخدام للغاية ومتكاملاً تمامًا في الوقت ذاته.

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