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
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale 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
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor 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
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

Ref in XML view

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
fieldsxmlformbaseattributeres.partner.xml
2 Antwoorden
2139 Weergaven
Avatar
NELSON ALEXANDER DIAZ DE LA CRUZ

I am trying to migrate a module from Odoo 16 to Odoo 18, but I have an error this code block:

                <field name="vat" placeholder="e.g. 123456789" string="RNC"

                       readonly="not parent_id"

                       invisible="country_id != ref('base.do') or not is_company"

                       required="is_fiscal_info_required" />


                <field name="vat" placeholder="e.g. 00112345678" string="Cédula"

                       readonly="not parent_id"

                       invisible="country_id != ref('base.do') or is_company"

                       required="is_fiscal_info_required" />

country_id != ref('base.do') is a valid expretion  

0
Avatar
Annuleer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste antwoord

Hi,

In Odoo 17+ (and now 18), XML expressions in views use a limited domain-like syntax, and ref('base.do') is not valid within a field attribute, such as invisible or readonly.


Please refer to the code below:


Python


from odoo import models, fields, api


class ResPartner(models.Model):

    _inherit = 'res.partner'


    is_dominican = fields.Boolean(compute="_compute_is_dominican", store=False)


    @api.depends('country_id')

    def _compute_is_dominican(self):

        dom_country = self.env.ref('base.do', raise_if_not_found=False)

        for rec in self:

            rec.is_dominican = rec.country_id == dom_country


XML


<field name="vat" placeholder="e.g. 123456789" string="RNC"

       readonly="not parent_id"

       invisible="not is_dominican or not is_company"

       required="is_fiscal_info_required"/>


<field name="vat" placeholder="e.g. 00112345678" string="Cédula"

       readonly="not parent_id"

       invisible="not is_dominican or is_company"

       required="is_fiscal_info_required"/>


Hope it helps.

0
Avatar
Annuleer
NELSON ALEXANDER DIAZ DE LA CRUZ
Auteur

This only shows the first one, only the field with RNC as the string.

Avatar
Christoph Farnleitner
Beste antwoord

Your best bet is to define a computed boolean field on that model, i.e. show_child_contact_vat, and use it as the invisible condition.

0
Avatar
Annuleer
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
Is it possible to enforce a float field in a form to accept values only between 0 and 99?
views fields xml form margin
Avatar
Avatar
Avatar
5
jul. 15
8805
How is it added a new field in XML specifying on_change attribute at the same time? Opgelost
fields xml sale.order.line attribute odooV8
Avatar
Avatar
1
jul. 15
5032
Custom field to base field
fields custom base
Avatar
Avatar
Avatar
3
jan. 25
14485
Possibility to add dynamic fields in Form view
fields form odoo
Avatar
Avatar
Avatar
2
sep. 23
11179
Hello, I would like to know where I can edit the xml of this part of the form view
views xml form
Avatar
Avatar
1
nov. 22
4448
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
  • Partner worden
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 Svenska ภาษาไทย 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