Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

How can I use a search view into a view displayed by a button ?

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
actionviewsearchtreebutton
1 ตอบกลับ
17874 มุมมอง
อวตาร
PJ Soule

Hi everyone.

I'm new to OpenERP, and I experience some issue to display a view by clicking on a button from another view (creating an ir.action.act_window object). I can display the view that I want to, but the search view isn't available.

When I display the view from a menu link, no problem, my search view appears and is functional.

Here the XML for the tree I want to display and my search view :

<!-- Search view -->
     <record id="view_search_result_filter" model="ir.ui.view">
        <field name="name">Filtres des résultats</field>
        <field name="model">flights.result</field>
        <field name="arch" type="xml">
            <search string="Résultats">
                <group expand="1" string="Group By...">
                    <filter name="solu" string="Solution" domain="[]" context="{'group_by':'solution_name'}"/>
                    <filter name="traj" string="Trajet" domain="[]" context="{'group_by':'journey_name'}"/>
                </group>
            </search>
        </field>
    </record>

    <!-- Tree view -->
    <record id="flights_result_tree" model="ir.ui.view">
        <field name="name">flights.result.tree</field>
        <field name="model">flights.result</field>
        <field name="arch" type="xml">
            <tree string="Résultats">
                <field name="solution_name" invisible="1" />
                <field name="solution_number" invisible="1" />
                <field name="source" />
                <field name="airline" />
                <field name="fare" />
                <field name="fare_type" />
                <field name="private_fare" />
                <field name="journey_number" invisible="1"  />
                <field name="journey_name"  invisible="1" />
                <field name="alternative_number"  invisible="1" />
                <field name="alternative_name"  invisible="1" />
                <field name="alternative_departure_datetime" />
                <field name="alternative_arrival_datetime" />
                <field name="alternative_stops" />
                <field name="alternative_technical_stops" />
                <field name="alternative_departure_airport" />
                <field name="alternative_arrival_airport" />
          </tree>
        </field>
    </record>

And here is the code of the button which display my view :

def flight_open_results(self, cr, uid, ids, context=None):
    this = self.browse(cr, uid, ids, context=context)[0]
    tree_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'app_flights', 'flights_result_tree')[1]
    search_view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'app_flights', 'view_search_result_filter')[1]
    form_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'app_flights', 'flights_result_form')[1]

    res = {
        'type': 'ir.actions.act_window',
        'name': 'Résultats',
        'view_type': 'tree',
        'view_mode': 'tree,form',
        'res_model': 'flights.result',
        'domain':[('search_id','=',this.id)],
        'context':{'search_default_Current': 1, 'search_default_solu': 1, 'search_default_traj':1},
        'views': [(tree_id,'tree'),(form_id,'form')],
        'search_view_id': search_view_id
    }

    return res

And to finish, my menu link, which works well :

    <record model="ir.actions.act_window" id="action_flights_results">
        <field name="name">Résultats</field>
        <field name="res_model">flights.result</field>
        <field name="view_type">form</field>
        <field name="domain">[]</field>
        <field name="view_mode">form,tree</field>
        <field name="view_id" ref="flights_result_tree" />  
        <field name="context">{'search_default_Current': 1, 'search_default_solu': 1, 'search_default_traj':1}</field>
    </record>

    <menuitem name="Résultats"
        parent="menu_engine_flights"
        id="menu_engine_flights_results"
        action="action_flights_results"/>

As you see, I added a form view to make some tests, and :

  • From the "normal" view, opened with a menu link, everything works fine : I can click on a line, my form view shows, with controls to navigate between elements on the top of the page.

  • From the view opened from the button, when I click on a line of my tree, nothing happens. And when I switch to the form view, there is no record loaded and I don't have any navigation control, only the possibility to create a new record.

I think this is a lead to the answer, but I don't know OpenERP weel enough to find the solution. Could you help me with this please ?

Thank you.

1
อวตาร
ละทิ้ง
อวตาร
Andreas Brueckl
คำตอบที่ดีที่สุด

In the return value of flight_open_results you should change the view_type from tree to form.

Also the view_mode ('tree,form') is different to that defined in action_flights_results ('form, tree').

2
อวตาร
ละทิ้ง
PJ Soule
ผู้เขียน

It works, thanks ! I'm really a newbie into the openERP world, and I dn't really understand why I have to call the form view to show the tree view, but though, it works, and that's all I needed. Thank you again !

สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
button on top of tree view
v6.1 view tree button
อวตาร
0
มี.ค. 15
5096
Regarding Tree View to Form View
action form view tree
อวตาร
0
มี.ค. 15
4602
"Search More..." in many2one field แก้ไขแล้ว
view many2one search tree more
อวตาร
อวตาร
อวตาร
อวตาร
อวตาร
4
พ.ย. 24
22088
Disable Create button in Tree view but keep Import
import treeview view tree button
อวตาร
0
ก.ค. 25
11967
Can we add a button between the search view and the tree?
search tree button between object
อวตาร
0
มี.ค. 15
4339
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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