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

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

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
developmentaccountingdebugattrs
2 Odpowiedzi
3448 Widoki
Awatar
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
Awatar
Odrzuć
odoo dev
Autor

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.

Awatar
Cybrosys Techno Solutions Pvt.Ltd
Najlepsza odpowiedź

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
Awatar
Odrzuć
Awatar
André Canilho
Najlepsza odpowiedź

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
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 hide Analytic Plans in Budget forum based on analytic plans chose in a field(chosen_plans)
development accounting attrs
Awatar
0
cze 25
885
Hide invoice header and footer in odoo v17 Enterprise
development configuration accounting debug
Awatar
Awatar
1
cze 25
1561
How to archive records in a model ? Rozwiązane
development setup accounting debug
Awatar
1
sty 25
2592
((#@@ColombiaConLATAM#@@)¿Cómo llamar a Latam Colombia desde un celular?
configuration attach accounting debug attrs
Awatar
0
lis 25
3
[LATAM~BOGOTA~telefono@COL]¿Cómo llamar a Latam Bogotá desde celular?
development configuration contribution debug attrs
Awatar
0
lis 25
21
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