Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Error "Contacts require a name" creating a user with custom module

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
erroruserscreateinheritsres.users
2 Odpowiedzi
17848 Widoki
Awatar
Daniel

I´m writing a custom module that had models that inherits from res.users to create custom users with some new filds.
I´m using delegation inheritance type to have another table for the fields of my custom users.
The schema is similar to: res.partner-->res.users-->custom_users.
I named the custom users "progenitor_tutor". I can access fields of res.users and res.partners like email or login from my custom view, but the problem is that when I´m trying to create a new custom user from the custom user view, a pop up appears and says:

Odoo Server Error - Validation Error

Contacts require a name.

And the res.partner, res.users, and progenitor_tutor (the custom user) datas are not created.
This is the code of my custom view and the custom model:

------------------------

<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<!--Tree View of progenitor_tutor-->
<recordmodel="ir.ui.view"id="progenitor_tutor_tree_view">
<fieldname="name">progenitor_tutor.tree.view</field>
<fieldname="model">aula10.progenitor_tutor</field>
<fieldname="arch"type="xml">
<treestring="progenitor_tutor">
<fieldname="name"/>
<fieldname="login"/>
</tree>
</field>
</record>

<!--Form View of progenitor_tutor-->
<recordmodel="ir.ui.view"id="progenitor_tutor_form_view">
<fieldname="name">progenitor_tutor.form.view</field>
<fieldname="model">aula10.progenitor_tutor</field>
<fieldname="arch"type="xml">
<form>
  <sheet>
<fieldname="id"invisible="1"/>
<divclass="oe_button_box"name="button_box">
<buttonname="toggle_active"type="object"class="oe_stat_button"icon="fa-check">
<fieldname="active"widget="boolean_button"options='{"terminology": "active"}'/>
</button>
</div>
<fieldname="image"widget='image'class="oe_avatar"options='{"preview_image": "image_medium"}'/>
<divclass="oe_title">
<labelfor="name"class="oe_edit_only"/>
<h1><fieldname="name"required="1"/></h1>
<fieldname="email"invisible="1"/>
<labelfor="login"class="oe_edit_only"string="Email Address"/>
<h2><fieldname="login"/></h2>
<group>
<fieldname="partner_id"readonly="1"required="0"groups="base.group_no_one"
attrs="{'invisible': [('id', '=', False)]}"/>
</group>
</div>
<notebookcolspan="4">
<pagename="access_rights"string="Access Rights">
<groupstring="Multi Companies"attrs="{'invisible': [('companies_count', '&lt;=', 1)]}">
<fieldstring="Allowed Companies"name="company_ids"widget="many2many_tags"/>
<fieldstring="Current Company"name="company_id"context="{'user_preference': 0}"/>
<fieldstring="Companies count"name="companies_count"invisible="1"/>
</group>
<fieldname="groups_id"/>
</page>
<pagestring="Preferences">
<group>
<groupstring="Localization"name="preferences">
<fieldname="lang"/>
<fieldname="tz"widget="timezone_mismatch"options="{'tz_offset_field': 'tz_offset'}"/>
<fieldname="tz_offset"invisible="1"/>
</group>
<groupstring="Menus Customization"groups="base.group_no_one">
<fieldname="action_id"/>
</group>
</group>
<groupstring="Messaging and Social"name="messaging">
<fieldname="signature"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<!--Action of progenitor_tutor-->
<recordmodel="ir.actions.act_window"id="progenitor_tutor_action">
<fieldname="name">Padres/Tutores</field>
<fieldname="res_model">aula10.progenitor_tutor</field>
<fieldname="view_type">form</field>
<fieldname="view_mode">tree,form</field>
</record>

<!--Menu-->
<menuitemname="Padres/Tutores"id="progenitor_tutor"action="progenitor_tutor_action"/>

</odoo>

---------------------------

from odoo import models, fields, api
#from odoo.exceptions import ValidationError
class progenitor_tutor(models.Model):
_name = 'aula10.progenitor_tutor'
_inherits = {'res.users': 'usuario_id'}
usuario_id = fields.Many2one('res.users', required=True, ondelete='restrict', auto_join=True, string='Usuario relacionado', help='Partner-related data of the user')
name = fields.Char('Nombre',required=True)
0
Awatar
Odrzuć
Hilar Andikkadavath

format your code

Awatar
Martin Varela
Najlepsza odpowiedź

The problem is that you are adding a field "name" in your new model. When you save the record, the name you type in the form is the one in 'aula10.progenitor_tutor' and not the one in res.partner, wich is required.
In the python file, remove:

name = fields.Char('Nombre',required=True)
Then you will use the one in res.partner, as res.users does.

-1
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
How to properly create a large amount of users?
create res.users
Awatar
Awatar
Awatar
2
lis 21
5131
Private Address option when I create a new user
users create
Awatar
Awatar
1
wrz 20
6167
Access rights tab layout in res.users is changed to tree view. Rozwiązane
users res.users v14
Awatar
Awatar
Awatar
2
lip 25
5541
Error Findings
invoice error create
Awatar
0
lis 23
2047
Can not create an CRM application
crm error create
Awatar
Awatar
1
mar 22
2608
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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