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
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • 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
    Procházet všechna odvětví
  • 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
    • Služby pro partnery
    • 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

How to display another view that a form view when I click on a record ?

Odebírat

Get notified when there's activity on this post

This question has been flagged
treevieweditrecordformviewpivot
9 Odpovědi
18220 Zobrazení
Avatar
MIADI

Hello,

In a personal module, I have a model and when I click on a record in the treeview, I have the form view to edit this record.

How to display another form view (like a pivot view or other) ?

Thanks for answers

0
Avatar
Zrušit
Mohammed Amal N

Hello Miadi,

Are you trying to add a pivot view for your model?

MIADI
Autor

When I click on a menuitem, I have a treeview with some records and when I click on a record, I want to show a pivot view.

MIADI
Autor

Instead of the form view that is display by default

Mohammed Amal N

I think what you are trying to achieve is making a pivot view for a single record instead of all the records of the model. As per my understanding this is not possible.

MIADI
Autor

Please check what I post in an answer and tell me if it's possible please

Avatar
MIADI
Autor Nejlepší odpověď

Or, I found another solution : it's to add a button on each record to display the pivot view. but it's gives me this error :

AttributeError: type object 'miadi.tarifs' has no attribute 'display_pivot_view'


Here are my codes :

class miadi_tarifs(models.Model):
    _name = 'miadi.tarifs'
    
    code = fields.Char(string='Code', default='', required=True)
    libelle = fields.Char(string='Libellé', default='', required=True)
    remise = fields.Float(string='Remise', digits=(5,2), default=0)
    
    _sql_constraints = [
    ('uniq_id', 'unique(code)', 'A pricelist already exists with this code. It must be unique !'),
    ]

@api.multi
    def display_pivot_view(self):
        tarif = self.code
        return {'name': _('Pivot Lines'), 'view_type': 'form', 'view_mode': 'pivot,tree', 'view_id': False, 'views': [(self.env.ref('miadi_packaging.miadi_lignestarifs_pivot').id or False, 'pivot'), (self.env.ref('miadi_packaging.miadi_lignestarifs_tree').id or False, 'tree')], 'res_model': 'miadi.lignestarifs', 'type': 'ir.actions.act_window', 'target': 'current', 'domain': [('code_tarif', '=', tarif),]} #Retourne la vue tableau, la treeview et la vue formulaire
class miadi_lignesTarifs(models.Model):
    _name = 'miadi.lignestarifs'
    
    code_tarif = fields.Many2one('miadi.tarifs', 'Price Code', default='', required=True, ondelete='cascade')
    numero_ordre = fields.Integer('Order number')
    produit_id = fields.Many2one('product.product', 'Product', required=True, ondelete='cascade')
    conditionnement_id = fields.Many2one('miadi.packaging', 'Packaging', required=True, ondelete='cascade')
    prix_unitaire = fields.Float('Unit Price', default=0)
<record id="miadi_tarifs_tree" model="ir.ui.view">
            <field name="name">miadi.tarifs.tree</field>
            <field name="model">miadi.tarifs</field>
            <field name="arch" type="xml">
                <tree string="Prices" >
                    <field name="code" />
                    <field name="libelle" />
                    <field name="remise" />
                    <button name="display_pivot_view" type="object" string="Table view" class="oe_highlight" />
                </tree>
            </field>
        </record>

How to fix the problem ?

0
Avatar
Zrušit
Mohammed Amal N

You give your button action in "wizard.pivot.view" and button in "miadi.tarifs"

Mohammed Amal N

also display button in form view not tree

MIADI
Autor

Yes I saw the error just before to see your comment.

I had a button in each record in the treeview because I want on click on the button to display the pivot view for this record

MIADI
Autor

Can you help me ?

With the code in the answer, when I click oon the button for a record, it display the pivot form but with all records (all prices) but I want only the pivot view for the record where I click on the button. I don't know if you understand me

Mohammed Amal N

Pivot view is usually used for analysing all datas. There is no point in showing a single record.

Anyway you can achieve that by passing required filters

MIADI
Autor

It worked in a post where you answered yesterday. So, why here it doesn't work ?

Mohammed Amal N

I told you whats the error.

MIADI
Autor

Yesterday, in this post (mine) : https://www.odoo.com/fr_FR/forum/aide-1/question/how-to-display-a-pivot-view-after-a-form-view-depending-of-a-field-120339

You gave me a solution to have the pivot view depending of one field and here, it's the same but it doesn't work...

The difference is, instead of open a wizard with a field, I add a button directly in the record in the table where the field were selected.

MIADI
Autor

I found the solution ! Thank you for your help

Avatar
Tai Le Thanh
Nejlepší odpověď

In the action

 <!-- action --> 
    <record id="yourid" model="ir.actions.act_window">
    <field name="name">....</field>
    <field name="res_model">yourmodel</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
</record>
I just know "view_type" which is the type of view when I click on a record
0
Avatar
Zrušit
MIADI
Autor

Hi, I tried to put "pivot" instead of "form" in the view_type and it gives me : ParseError: "Wrong value for ir.actions.act_window.view_type: 'pivot'"

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
How to open another type of view thant a form view when I click on a record ?
click record formview pivot
Avatar
2
čvn 17
4652
From tree view to dynamic form view
treeview formview
Avatar
Avatar
1
zář 23
5414
How can I use a specific tree view with the pivot table
treeview pivot
Avatar
Avatar
2
kvě 21
4920
Its possible to add a tree view inside a form view with group_by filter applied
treeview group_by formview
Avatar
Avatar
2
čvn 22
4759
How to redirect to form view after clicking row in custom SQL tree view? (14.0)
views treeview formview
Avatar
0
zář 21
3246
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