Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

How to change a res.partner form field to required?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
viewscustom_moduleinherit_res.partner
3 Antwoorden
4403 Weergaven
Avatar
Mario Ivan

Odoo version: 17.0

 I am trying to change the "street" field of the view_partner_form form from a custom module but when I do so my changes do not take effect, records are still being made with the "street" field empty.



Details here

Al realizar los cambios desde el modelo me aparece el siguiente mensaje:


0
Avatar
Annuleer
Avatar
Bhushan vagh
Beste antwoord


1
Avatar
Annuleer
Avatar
Jainesh Shah(Aktiv Software)
Beste antwoord

Hello Mario Ivan,


Hope you are doing well.


Add below snippet code in your xml file first. after that just go to the point 1 for further process.


//Code in Comment//

1 Add XML file in manifest as mentioned in below snippet code. 

2 Update Module:

-> After making changes to your custom module, ensure you update the module to apply the changes:

3 Enable Developer Mode:

-> In Odoo, enable Developer Mode (Debug Mode) to inspect the view and ensure your changes are being loaded. 

    You can also use the "View Fields" feature to verify the properties of the street field.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

0
Avatar
Annuleer
Jainesh Shah(Aktiv Software)

Code :

<record id="view_partner_form_inherit" model="ir.ui.view">
<field name="name">partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="street" position="attributes">
<attribute name="required">True</attribute>
</field>
</field>
</record>

Avatar
noone
Beste antwoord

Hi Mario:

Did you restart the server and upgrade your customize module ? 

 If you did not set your development config with "--dev=xml" or "--dev=all" ,  you might need to restart and upgrade the module to activate your change.

Personally i think your code shown as your image looks good. By the way, if you want to locate to a specific field, you can try using directly the field element locator   :

    <field name="street" position="attributes">

        <attribute="..."> ...  </attribute>

    </field>

   


 


0
Avatar
Annuleer
Mario Ivan
Auteur

Yes, I have restarted the server and updated the module manually. But still the changes have no effect. I wanted to make this change only in the form view "view.partner.form", for now I solved it from the "res.partner" model, even though the change works when doing it this way an error appears in the log with the following message: "Table 'res_partner': unable to set NOT NULL on column 'street'".

noone

Hi Mario:

The error log actually means the setting "required=True" on the field already works. It's generated by sql constraint : since the field has been set to 'required', the ORM or say the database will check if any value allocated to such field before writing. If no valid value, It will raise an error like your log and abort writing into the database.

Two ways can verify:
1、Check the column's properties in pgAdmin :
open your database in pgAdmin -> go to the table 'res_partner', right-click on it -> open the 'properties' window -> click on the tab 'column' , you can see the if the option 'NOT NULL' is checked on the field 'street';

2、create a new record
You can try to create a new record , leave the field 'street' empty and save, a notification must popup at the upper right corner of the page indicating ** field can be empty.

noone

In one word, ‘required=True’ will pass an instruction to database that the column(field) must be NOT NULL (not empty)and vice versa.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
custom module - psycopg2.errors.NotNullViolation
views custom_module custom_view
Avatar
Avatar
1
mrt. 21
9923
Select multiple elements with XPath Opgelost
views
Avatar
Avatar
Avatar
Avatar
Avatar
5
aug. 24
48160
Filter out (hide) lines in tree component Opgelost
views
Avatar
Avatar
Avatar
2
apr. 24
3435
What are the different types of views available in Odoo? Opgelost
views
Avatar
Avatar
Avatar
Avatar
3
jun. 23
7803
view layout (two fields on the same row within an xpath) Opgelost
views
Avatar
Avatar
2
jun. 23
5787
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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