Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

how to get current value of a record line in a XML tree view

Naroči se

Get notified when there's activity on this post

This question has been flagged
actionmoduletreeviewxmlodoov11
1 Odgovori
8621 Prikazi
Avatar
mandengue

Hi everyone , thank you very much for your help and support . I have started my first module with odoo 11 but i am facing a problem. Please forgive my poor level in english , i am doing my best.So, here is my problem: I have created two models : let 's say model 1 and model 2.In the xml tree view of model 1 , for each record line i added a button "pay now" . what i want is that when i click on the "pay now" button (on model1 tree view) it opens a form of model 2 (in a popup window) with the defaults values filled by some informations providing by model 1 's line selected on tree view.

here is my tree view ....

let s  take these fields names as examples:

field1            |          field2           |         field3    |   field4          |  field5


the button code for the tree view is

<tree>
<button
name="%(custom_action_id)d" string="Pay now" class="oe_highlight" type="action"/>
</tree>

the action code called by the button is

 <record id="custom_action_id" model="ir.actions.act_window">
<field
name="name">list examples</field>
<field
name="res_model">model2.name</field>
<field
name="src_model">model2.name</field>
<field
name="view_type">form</field>
<field
name="view_mode">form</field>
<field
name="target">new</field>
</record>

what i want is that if i click on pay now the model2 form opens ,having by default the fields filled by values of the line selected on tree view.

here is an example of the form called:

                         field5                                                              field6


remark: field6's value should be equal to field2 's value and field5's value should be equal to field1's value . Field5 's type is Many2one while field1's type (which will provide field5's value) is a char type.

Once again thank you to anyone who will take the time to read my post.

best regards


0
Avatar
Opusti
Avatar
mandengue
Avtor Best Answer

Hi , i found the solution .

in the tree view of model 1 , i have used the context attribute on the button to define my default values.

eg :

<button name"%(target_action)d string="Pay now" type="action" context="{'param1': active_id,'param2':field2}"/>

and in the record action

<field name="context">{'default_field5_name': context.get('param1', False),'default_field6_name': context.get('param2', False),}</field>
0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
how open custom type view from kanban and tree when click on record? Solved
action treeview xml kanban odoo12
Avatar
Avatar
Avatar
8
okt. 21
13392
Inheritance : Can't see the new field on the form view Solved
treeview xml form inheritance odoov11
Avatar
Avatar
3
feb. 18
7897
Error "Invalid name definition" when installing module
module odoov11
Avatar
0
avg. 18
5644
OdooV11 : Hierarchical Tree view in Odoo 11 ?
treeview odoov11
Avatar
Avatar
Avatar
2
jul. 18
10760
How can I create treeview inside a treeview
treeview xml
Avatar
0
jun. 15
4499
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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