Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
treevieweditrecordformviewpivot
9 Răspunsuri
18212 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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

Imagine profil
MIADI
Autor Cel mai bun răspuns

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
Imagine profil
Abandonează
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

Imagine profil
Tai Le Thanh
Cel mai bun răspuns

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
Imagine profil
Abandonează
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!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to open another type of view thant a form view when I click on a record ?
click record formview pivot
Imagine profil
2
iun. 17
4652
From tree view to dynamic form view
treeview formview
Imagine profil
Imagine profil
1
sept. 23
5410
How can I use a specific tree view with the pivot table
treeview pivot
Imagine profil
Imagine profil
2
mai 21
4920
Its possible to add a tree view inside a form view with group_by filter applied
treeview group_by formview
Imagine profil
Imagine profil
2
iun. 22
4758
How to redirect to form view after clicking row in custom SQL tree view? (14.0)
views treeview formview
Imagine profil
0
sept. 21
3238
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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