Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

how to put fields under a single condition in form view (odoo version 17)

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
developmentaccountingdebugattrs
2 Replies
3444 Rodiniai
Portretas
odoo dev

I have a scenario where I've added numerous custom fields to the account.move inherited view, and most of these fields share the same visibility condition. The challenge is that I need to write multiple conditions to control their visibility. Whenever a requirement changes, I must update the condition for multiple fields individually. Additionally, if I want to display a field for multiple move_types , I end up writing lengthy conditions for each field.

Over time, the account.move form view has become very large due to these customizations and conditions, making it increasingly difficult to implement changes without risking disruptions to other flows, such as vendor bills, customer invoices, and journal entries. Is there a more efficient way to manage this, where I can define a single condition that applies to multiple fields, simplifying maintenance and ensuring stability across the views? basically an if block where i can check the move type and define all the fields for a certain move_type, similarly another if condition to deal with another move_type

0
Portretas
Atmesti
odoo dev
Autorius

I don’t have enough karma to post, so I’m commenting here. As Andre mentioned, I’d prefer using the second option, but the challenge I’m facing is how to create separate workflow views while inheriting the original account.move form view. I want to avoid copying the entire XML from the original form view into my custom view. Instead, I’d like to inherit the form view for each workflow, allowing me to manage fields based on the specific workflow.

Portretas
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,


You can simplify your process as follows.


1- Add a boolean field in the 'account.move'. It should be a computed field and made invisible in the form view. Add the compute function and add all your conditions in the function.

This field will encapsulate your condition logic (e.g., move_type == 'out_invoice'). It will be used to control field visibility in the view.

     class AccountMove(models.Model):

    """Inherited model 'account.move'."""
_inherit = 'account.move'

is_check_condition = fields.Boolean(string="Check Condition",
help="Compute field for check the field conditions",
compute="_compute_conditions")
# Add your custom fields


def _compute_conditions(self):
"""Compute field for checking the field visibility of the custom fields"""
for rec in self:
if rec.move_type == 'out_invoice': #Add all the condition that make the boolean field True
rec.is_check_condition = True
else:
rec.is_check_condition = False


2- Add the computed boolean field as the invisible attribute of the custom fields.


<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form.inherit</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
#Add the compute field and make it invisible
<xpath expr="//group[@id='header_right_group']" position="inside">
<field name="is_check_condition" invisible="1"/>
</xpath>
# Add the boolean field as the condition for the custom field
<xpath expr="//#" position="inside">
<field name="custom_field" invisible="is_check_condition"/>
</xpath>
</field>
</record>



If you have multiple distinct conditions, you can create multiple computed booleans.This way, different sets of fields can reference different visibility flags.


Hope it helps.


0
Portretas
Atmesti
Portretas
André Canilho
Best Answer

Hi.
Managing large views is always hard especially when the conditions start to increase exponentially. 

Someway you can make the process easier:

Option 1: Define a new selection field that tracks each workflow, and have a computed action for changing the visibility of the other fields, or set any rules you might have (domains, fields values, etc
).
This lets you define each process with a single user action, and every aspect of that workflow is embedded into a single function.

Option 2: Create one view per workflow type.
As before, this gives you more control over each workflow. The negative part is that you increase maintenance difficulty, as your fields are replicated through more locations, but for some cases this works well.

-1
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
How to hide Analytic Plans in Budget forum based on analytic plans chose in a field(chosen_plans)
development accounting attrs
Portretas
0
birž. 25
884
Hide invoice header and footer in odoo v17 Enterprise
development configuration accounting debug
Portretas
Portretas
1
birž. 25
1559
How to archive records in a model ? Solved
development setup accounting debug
Portretas
1
saus. 25
2592
((#@@ColombiaConLATAM#@@)¿Cómo llamar a Latam Colombia desde un celular?
configuration attach accounting debug attrs
Portretas
0
lapkr. 25
3
[LATAM~BOGOTA~telefono@COL]¿Cómo llamar a Latam Bogotá desde celular?
development configuration contribution debug attrs
Portretas
0
lapkr. 25
21
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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