Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

[SOLVED] How can I change the popup form which a function field generates?

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
1 Antworten
8225 Ansichten
Avatar
Juan Formoso Vasco

I have created a new model, called res.partner.link.category, whose fields are: active_category, partner_id, link_category_id, type, date and observations.

And in the model res.partner, I added a new field (a function of type many2many pointing to the new model I have created). Here the Python code:

'history': fields.function(_get_history, type='many2many',
                            obj="res.partner.link.category",
                            method=True, string='Categories'),

Then, I want to show it in the res.partner form, as a list of records, so I added this code to the XML of res.partner form:

<group>
    <field name="history" nolabel="1">
        <tree string="Categories">
            <field name="active_category"/>
            <field name="link_category_id"/>
            <field name="type"/>
            <field name="date"/>
            <field name="observations"/>
        </tree>
    </field>
</group>

It works great. Note that I do not show the field partner_id inside the tree, and in fact it is not being shown, so perfect. But, if I click on any record of the tree, a popup form is opened, with all the fields of res.partner.link.category, including partner_id, which I do not want!

So I would like to know how to modify that form (I tried to create the next customized form for res.partner.link.category):

<record id="res_partner_link_category_view" model="ir.ui.view">
    <field name="name">res.partner.link.category.form</field>
    <field name="model">res.partner.link.category</field>   
    <field name="type">form</field>
    <field name="arch" type="xml">
        <group>
            <field name="active_category"/>
            <field name="link_category_id"/>
            <field name="type"/>
        </group>
        <group>
            <field name="date"/>
            <field name="observations"/>
        </group>
    </field>
</record>

This last code is being ignored of course. I did not know where I could declare this form view and I did it in the same XML document where I modified the res.partner form (through inheritance). I do not know if it can be a problem, I guess not.

Anyone can help me, please? Thank you!

EDIT (this is my new declaration of the form, not working yet)

<group string="Activity Summary">
    <field name="history" nolabel="1">
        <form string="Categories" version="7.0">
            <group col="4">
                <field name="link_category_id"/>
                <field name="type"/>
            </group>
            <group col="4">
                <field name="date"/>
                <field name="observations"/>
            </group>
        </form>
        <tree string="Categories">
            <field name="active_category"/>
            <field name="link_category_id"/>
            <field name="type"/>
            <field name="date"/>
            <field name="observations"/>
        </tree>
    </field>
</group>

2
Avatar
Verwerfen
Pau Ubach

Hola Juan, You can just add a form inside of the field, as you do with the tree: ...

Juan Formoso Vasco
Autor

Hey, I do not know why, but suddenly all the comments were removed when I sent the last one. I had written you that I needed to show a tree with only one record per category (the one with the latest date), so I used a function to return the list with the codes of these records.

Pau Ubach

OK, now I understand why you use the function field.

Pau Ubach

I assume you're defining the many2many field for the relation in res.partner.link.category, aren't you?

Juan Formoso Vasco
Autor

No, I am not. The field function of type many2many is declared in res.partner.

Pau Ubach

OK. First of all, you shouldn't edit the res.partner. You should create a new module that inherits from it instead.

Juan Formoso Vasco
Autor

Yes, I did so. The name of my module is res_partner_extended, inherits from res.partner and adds that column function of type many2many, pointing to res.partner.link.category, a table created by me from zero.

Pau Ubach

Great. I'm totally lost. When I had to do for one2many I just checked how was it done in an existing module. I don't know if there's any doing what you need. If you solve it, please post how have you done.

Juan Formoso Vasco
Autor

Ok, I'll do that. Thank you so much for your patience.

Pau Ubach

No problem. I have had people having patience with me, so trying to help the others is the way to repay for it.

Avatar
Deepa Venkatesh
Beste Antwort

I assume you want to show just the tree view for M2M field, but unfortunately you cant prevent it from opening the form view...

Whenever you define a O2M or M2M field in view: when you have embedded its views within the field declaration, then preference are given to those local views, if not then it searchs whether any views exists for that object, if none, then odoo uses a default view by dumping all the fields into form view...
 

So in your code [edited code] though you have locally defined the views, but what you missed was the "mode" property to be set, which tells odoo that the views are defined locally...

Here your code goes something like this:

<field name="history" mode="tree,form" ... >

 

0
Avatar
Verwerfen
Pau Ubach

I was waiting for you, deep ;). Actually my last comment in the question was done as a tribute to you.

Deepa Venkatesh

Oh is it.. :):) thank you

Juan Formoso Vasco
Autor

Thank you deep, and Pau again. Now I know why OpenERP is behaving this way.

Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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