Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

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

Odebírat

Get notified when there's activity on this post

This question has been flagged
erroruserscreateinheritsres.users
2 Odpovědi
17846 Zobrazení
Avatar
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
Avatar
Zrušit
Hilar Andikkadavath

format your code

Avatar
Martin Varela
Nejlepší odpověď

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
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
How to properly create a large amount of users?
create res.users
Avatar
Avatar
Avatar
2
lis 21
5119
Private Address option when I create a new user
users create
Avatar
Avatar
1
zář 20
6167
Access rights tab layout in res.users is changed to tree view. Vyřešeno
users res.users v14
Avatar
Avatar
Avatar
2
čvc 25
5539
Error Findings
invoice error create
Avatar
0
lis 23
2047
Can not create an CRM application
crm error create
Avatar
Avatar
1
bře 22
2608
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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