Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • 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:

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

Error new create a new record --AttributeError: '_unknown' object has no attribute 'id'--

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
modulescustomization
8 Ответы
32535 Представления
Аватар
Alfonso Gonzalez

I'm not a expert but i create a tiny modules before now i'm getting this error, i have been development other models of this same module without error after two weeks, i'm asking help because I cannot find the error.


When I install the module the first time on clean database, i can create a record, but next times or if i uninstall and reinstall i cannot.


This is the error i got:

RPC_ERROR

Odoo Server Error

Traceback (most recent call last):

File "D:\OdooCDev\server\odoo\addons\base\models\ir_http.py", line 237, in _dispatch

result = request.dispatch()

File "D:\OdooCDev\server\odoo\http.py", line 688, in dispatch

result = self._call_function(**self.params)

File "D:\OdooCDev\server\odoo\http.py", line 360, in _call_function

return checked_call(self.db, *args, **kwargs)

File "D:\OdooCDev\server\odoo\service\model.py", line 94, in wrapper

return f(dbname, *args, **kwargs)

File "D:\OdooCDev\server\odoo\http.py", line 349, in checked_call

result = self.endpoint(*a, **kw)

File "D:\OdooCDev\server\odoo\http.py", line 917, in __call__

return self.method(*args, **kw)

File "D:\OdooCDev\server\odoo\http.py", line 536, in response_wrap

response = f(*args, **kw)

File "D:\OdooCDev\server\odoo\addons\web\controllers\main.py", line 1348, in call_kw

return self._call_kw(model, method, args, kwargs)

File "D:\OdooCDev\server\odoo\addons\web\controllers\main.py", line 1340, in _call_kw

return call_kw(request.env[model], method, args, kwargs)

File "D:\OdooCDev\server\odoo\api.py", line 464, in call_kw

result = _call_kw_multi(method, model, args, kwargs)

File "D:\OdooCDev\server\odoo\api.py", line 451, in _call_kw_multi

result = method(recs, *args, **kwargs)

File "D:\OdooCDev\server\odoo\models.py", line 6490, in onchange

result['value'] = snapshot1.diff(snapshot0, force=first_call)

File "D:\OdooCDev\server\odoo\models.py", line 6314, in diff

result[name] = field.convert_to_onchange(self[name], record, {})

File "D:\OdooCDev\server\odoo\fields.py", line 2836, in convert_to_onchange

if not value.id:

Exception



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



Traceback (most recent call last):

File "D:\OdooCDev\server\odoo\http.py", line 644, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "D:\OdooCDev\server\odoo\http.py", line 302, in _handle_exception

raise exception.with_traceback(None) from new_cause

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

Now this is my model: 

from odoo import fields, models, api


class Expedientes(models.Model):
_inherit = ['mail.thread']
_name = 'logimpex.expedientes'
_description = 'Expedientes'
_rec_name = 'name'
_order = 'name'

# Información General del Expediente
name = fields.Char(string='Expediente', default='New', required=True, index=True)
operation_type = fields.Many2one('logimpex.operation', string='Tipo de Operación', required=True, tracking=True)
service_type = fields.Selection([('load', 'Cargo'), ('moving', 'Mudanza')],
string='Cargo / Mudanza', required=True, tracking=True)
move_type = fields.Selection([('import', 'Importación'), ('export', 'Exportación'), ('national', 'Nacional')],
string='Imp / Exp / Nac', required=True, tracking=True)
transportation_type = fields.Selection([('marine', 'Marítimo'), ('air', 'Aéreo'), ('ground', 'Terrestre')],
string='Marítimo / Aéreo / Terrestre', required=True, tracking=True)
transportation_border = fields.Many2one('logimpex.borders', string='Frontera', tracking=True)

# Información de Peso Volumen
volumen = fields.Float(string='Volumen (m³)', tracking=True)
weight = fields.Float(string='Peso (kg)', tracking=True)
weight_chargeable = fields.Float(string='Peso Cobrable (kg)', tracking=True)
pza_num = fields.Integer(string='# de Piezas', tracking=True)
amount = fields.Monetary(string='Valor', tracking=True)
currency_id = fields.Many2one('res.currency', string='Moneda', tracking=True)
note = fields.Text(string='Descripción', tracking=True)

# Información de Origen / Destino / Viaje
origin = fields.Many2one('res.country', string='Origen', required=True, tracking=True)
destiny = fields.Many2one('res.country', string='Destino', required=True, tracking=True)
start_date = fields.Date(string='Fecha Inicio', default=fields.Date.today, tracking=True)
end_date = fields.Date(string='Fecha Fin', default=fields.Date.today, tracking=True)
partner_id = fields.Many2one('res.partner', string='Cliente', required=True, tracking=True)
responsable_id = fields.Many2one('res.users', string='Responsable', tracking=True)

# Información de Seguimiento
ref = fields.Char(string='Referencia Interna', tracking=True)
pickup = fields.Char(string='Recolección', tracking=True)
load = fields.Many2one('logimpex.ports.airports', string='Carga', tracking=True)
unload = fields.Many2one('logimpex.ports.airports', string='Descarga', tracking=True)
delivery = fields.Char(string='Entrega', tracking=True)
master = fields.Char(string='Master', tracking=True)
house = fields.Char(string='House', tracking=True)
incoterm_id = fields.Many2one('account.incoterms', string='Incoterms', tracking=True)

# Campos de Documentación del Embarque
doc_embarque = fields.Binary(string="Documentos de Embarque")
doc_factura_comercial = fields.Binary(string="Factura Comercial")
doc_lista_empaque = fields.Binary(string="Lista de Empaque")
doc_blawbbol = fields.Binary(string="BL / AWB / BOL")
doc_cert_origen = fields.Binary(string="Certificado de Origen")
doc_ficha_tecnica = fields.Binary(string="Ficha Técnica")


and this is my view:





logimpex.expedientes.tree
logimpex.expedientes



























logimpex.expedientes.form
logimpex.expedientes




























































logimpex.expedientes.search
logimpex.expedientes
















































logimpex.expedientes.gantt
logimpex.expedientes

date_stop="end_date"
default_group_by='partner_id'>






Expedientes
ir.actions.act_window
logimpex.expedientes
form
tree,form,gantt


Crear tu primer registro!










0
Аватар
Отменить
Long Duong Nhat

Hi!

Could you check that you have added the necessary depends to your __manifest__.py? It is similar as you didn't add the dependency to the "product" module that contains the "product.template" model.

"depends": ["product"],
As a suggestion, the relation field name would be more clearer if it will have the suffix "_id" for Many2one fields and "_ids" for Many2many or One2many fields. As recommended in Odoo Developer Guidelines: https://www.odoo.com/documentation/14.0/developer/misc/other/guidelines.html?highlight=developer guideline#symbols-and-conventions

Alejandro Fredes
Estimados, me encuentro con licencia médica desde el lunes 26 hasta el miércoles 28
Аватар
Kripa Kanjirathinkal
Лучший ответ

Please check your manifest file, file must have depends on the specified models (models used in many2one)


'depends': ['base', 'account', 'logimpex'], 

5
Аватар
Отменить
Аватар
Tag Hassan
Лучший ответ

I had the same error and I found a misspelling in comdel_name in the inverse_name field in the line model, I was writing the definition of the field "field_id = fields.Many2one(comdel_name='" and it should be written comodel_name, so that error was raised, when I fixed this misspelling the error go away.

I hope this may help someone,

Thanks

0
Аватар
Отменить
Аватар
Javier Vescio
Лучший ответ

Hi. In my case, I was getting the same error. It was because I had one many2one with underscore for the model name. For example, I had somehting like this:

`Many2one('project_task', ...)` Wrong

The correct way is with a dot, like this:

`Many2one('project.task', ...)` Good

0
Аватар
Отменить
Аватар
Pavel
Лучший ответ
I had the same problem putting a Many2one with the 'account.asset' model and the problem was that it had to depend on account_asset and not on account, because account_asset was where the 'account.asset' model was.

0
Аватар
Отменить
Аватар
Hussein Kadweka
Лучший ответ

I personally had the same error too and the problem is either your one2many or many2one or many2many fields.......its likely you have misspelt the relation model 

The other scenario is either your module depends on another module that you haven't added it to depends 

0
Аватар
Отменить
Аватар
JJB Conseil
Лучший ответ

Hi Alfonso,

Did you find the problem because i'm facing the same and i could not find the solution!?

Vincent

0
Аватар
Отменить
Аватар
jdossougoin@gmail.com
Лучший ответ

Great ! Thanks for your answer. It helps me.

0
Аватар
Отменить
Аватар
Alejandro Fredes
Лучший ответ

Hi! I had the same issue and I resolved it by checking my o2m/m2o relations. I thought I wrote everything right but I made a typing error when writing the comodel's name.

I don't see all the custom models you have but I think you can check if all your m2o/o2m relations are ok.

0
Аватар
Отменить
Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
Create manually created fields later in modules
modules fields customization
Аватар
0
апр. 22
3271
error removing a module with custom fields Решено
modules customization remove
Аватар
Аватар
1
янв. 24
7048
Best way to customize OpenERP?
modules translation customization
Аватар
Аватар
1
мар. 15
5748
Nuevo menú en "CRM"
modules
Аватар
Аватар
Аватар
Аватар
3
июл. 25
2771
Allow Access to update module
modules
Аватар
Аватар
Аватар
Аватар
3
мая 25
4643
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة 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 – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

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