Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

[V8] Is there a way to have two buttons on the same position on a tree view (not at the same time)?

Odebírat

Get notified when there's activity on this post

This question has been flagged
v8buttonscustomization
5 Odpovědi
8490 Zobrazení
Avatar
FEDERICO LEONI

As subject. I have two buttons that disappears when the other is active. Is there a way to have it on the same row?

As far as I know Odoo smart buttons can't do that...

Edit: Here is my xml source code:

<openerp>
<data>
<record id= "Kitchen_orders_tree_view" model= "ir.ui.view">
<field name= "name">Kitchen_orders_tree</field>
<field name= "model">rest.order</field>
<field name= "field_parent" eval="False"/>
<field name= "arch" type= "xml">
<tree string = "Pedidos da Cozinha" colors="red:to_wait=='Sim'" create="false">
<field name= "date_order" on_change="on_change_kot_time(date_order,end_date)"/>
<field name = "partner_name"/>
<field name = "qty"/>
<field name = "product_name"/>
<field name = "instructions"/>
<field name= "end_date" on_change="on_change_kot_time(date_order,end_date)"/>
<field name = "to_wait" invisible = "1"/>
<field name= "minutes" on_change="on_change_kot_time(date_order,end_date)"/>
<field name = "status" />
<button name="642" string="Avançar" type="action" attrs="{'invisible':[('to_wait','=','Não')]}" />
<button name="638" string="Enviar" type="action" attrs="{'invisible':['|', ('status','=','Pronto'), ('to_wait','=','Sim')]}" />

</tree>
</field>
</record>
<record model= "ir.actions.act_window" id= "kitchen_orders">
<field name= "name">kitchen_orders_action</field>
<field name= "type">ir.actions.act_window</field>
<field name= "res_model">rest.order</field>
<field name= "view_type">form</field>
<field name= "view_mode">tree</field>
<field name= "view_id" eval="False"/>
<field name= "domain">[]</field>
</record>
<menuitem
action= "kitchen_orders"
id= "kitchen_order_menu"
parent= "point_of_sale.menu_point_of_sale"
name= "Restaurant"
sequence= "10"/>
</data>
</openerp>

0
Avatar
Zrušit
Avatar
Bole
Nejlepší odpověď

No, they will always be in two columns.. 
but workaround could be ONE button (type=object) , calling one method (instead of two buttons for two actions!)

and in method you can decide based on some data will you trigger (return)  action_1 or action_2   ...

hope it helps a bit..

2
Avatar
Zrušit
FEDERICO LEONI
Autor

Interesting solution. Could you please elaborate more? Do you have a link to have a look on it? Thanks.

Bole

This is a bit hard to evaluate... my guess is that this part of view xml is not from source xml, looks more like you just copy/pate it from edit view wizard ... to elaborate more on this idea a quick look at whole module ( py & xml file) would be of help... maybe if your code is somewhere public availabel i could take a look at the module ?

FEDERICO LEONI
Autor

I've added my xml source. On the .py there is just the creation of the table.

Avatar
Yogesh
Nejlepší odpověď

You can change button label to "Avançar / Enviar" then call a method on that button. before you make any action first you check state of your record (you already have some field to distinguish that is used to change color to "Red /Black" ). if your record is in state which is making it black you write code which is written in "Enviar" button if your record is in state which is making it Red you can method which is written on button "Avançar".

f you don't want to label button like "Avançar / Enviar" but only "Avançar"  or  "Enviar" then you write fields_view_get() and change label of button based on State of record.





Hope that helps you :)

1
Avatar
Zrušit
FEDERICO LEONI
Autor

Know that there are solutions helps for sure but... fields_view_get() seems to be really complicated to use. In python I can do that in 2 minutes with if/elif. Anyway, I'll have a better look on it. Thanks.

Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
[V8] Is there a way to have two buttons on the same position on a tree view (not at the same time)?
v8 buttons customization
Avatar
0
čvn 15
120
[V8][server actions] Is possible to add CUSTOM icon directly on a module?
v8 customization icons
Avatar
0
čvc 15
4877
[V8] XML for server action: how to write on fields?
v8 customization server_actions
Avatar
Avatar
1
čvn 15
7030
Creating a Custom Theme - Running into Problems on Install.
v8 customization themes
Avatar
1
bře 15
4656
Get id of new Group Vyřešeno
security v8 buttons groups
Avatar
Avatar
2
čvc 15
7290
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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