Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

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

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
1 Atsakyti
8241 Rodiniai
Portretas
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
Portretas
Atmesti
Pau Ubach

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

Juan Formoso Vasco
Autorius

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
Autorius

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
Autorius

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
Autorius

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.

Portretas
Deepa Venkatesh
Best Answer

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
Portretas
Atmesti
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
Autorius

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

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

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

Registracija
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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