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

invisible elements on button click

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
formv7invisible
1 Odpowiedz
10307 Widoki
Awatar
Shaumyadeep Chaudhuri

Hi, I need to make hide some elements on a button click. How can i do that? currently i tried using 2 functional fields and a character field which doesn't seem to work. here is the xml snippet of what i'm trying to hide.

<sheet attrs="{'invisible':[('historical_concept','=','True')]}">.......</sheet>

and here's the python code

def _historical_concept(self,cr,uid,ids,field_name,argus,context):
    ret_val={}
    for record in self.browse(cr,uid,ids,context):
        if (record.historical_state is not False and record.historical_state == 'concept') or record.state in ['concept']:
            self.write(cr,uid,ids,{'historical_state':None})
            ret_val[record.id]=False
        else:
            ret_val[record.id]=True
    return ret_val

def historical_stage_concept(self,cr,uid,ids,context=None):
    return self.write(cr,uid,ids,{'historical_state':'concept'})

EDIT 1: Button code

<button name="historical_stage_concept" type="object"/>

EDIT 2: _coloumns and _defaults _column is too long so i paste only the relevant part if more is needed please ask.

_columns = {
             'state':fields.selection([
                                     ('concept', 'Concept'),
                                     ('develop', 'Develop'),
                                     ('market', 'Market'),
                                     ('refuse','Rejected')],
                                    'Stage', readonly=True), 
            'historical_state':fields.char(),
            'historical_concept':fields.function(_historical_concept, type='boolean', method=True, string='Historical Concept'),
            'historical_develop':fields.function(_historical_develop, type='boolean', method=True, string='Historical Develop'),
            }

_defaults = {
           'historical_state':None
           }
0
Awatar
Odrzuć
IBS Group

What does the button do? can you paste its XML line.

Shaumyadeep Chaudhuri
Autor

The button is just a button at the moment, i tried to make it an object and hence the python code above but that didn't work. My primary goal is making something invisible or visible on the button click but there are more than one buttons and the invisibility or visibility should not be stored to the database. those are the only requirements and doesn't matter how they are implemented

IBS Group

Can you paste the _columns declaration of your model.

Shaumyadeep Chaudhuri
Autor

i just pasted what i felt was relevant since the full thing is too long

Simplify it!

I don't think that this can be done with some python code, you have to write a JS file to do it.

Awatar
IBS Group
Najlepsza odpowiedź

These are the changes you must do :

if record.historical_state == 'concept':

and

<!-- The quotes are removed -->
<sheet attrs="{'invisible':[('historical_concept','=',True)]}">.......</sheet>
0
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 make a form more wide?
form v7
Awatar
Awatar
Awatar
3
mar 15
6737
How to delete the field "State" in partner form?
form v7
Awatar
Awatar
1
mar 15
5016
Open a form in Edit mode Rozwiązane
action form v7
Awatar
Awatar
1
maj 22
27089
Form Sheet width Rozwiązane
form v7 sheet
Awatar
Awatar
Awatar
Awatar
Awatar
8
maj 16
34958
Change title of automatically generated form view
form one2many v7
Awatar
Awatar
1
mar 15
18646
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