Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Referencing views from other pages

Odebírat

Get notified when there's activity on this post

This question has been flagged
viewswebsite_builderwebsitev10
1 Odpovědět
3276 Zobrazení
Avatar
Nathan Hardwick

I am trying to understand how to reference/retrieve information from other views on the website i.e. retrieve forum posts from another page. I can see how the forum page retrieves and displays the post but I can't see whether it is possible to reference the forum posts on another page, simply copying the same xml leads to a 500 server error as it cannot reach the data.

If you don't understand what I mean I can provide examples or clarify further.

1
Avatar
Zrušit
Avatar
Jérémy Kersten (jke)
Nejlepší odpověď
<ul t-foreach="request.env['forum.post'].search([])" t-as='p'>
    <li><span t-field='p.name'/> </li>
</ul>


The forum is probably a bad example since 'a post' is not in a separated template...


But, just to give you an idea...


<ul t-foreach="request.env['forum.post'].search([('forum_id', '=', 1)])" t-as='p'>
<t t-call='website_forum.post_description_full'>
<t t-set='question' t-value='p'/>
<t t-set='user' t-value='request.env.user'/>
<t t-set='forum' t-value="request.env['forum.forum'].browse(1)"/>
<t t-set='reversed' t-value="lambda x: x"/>
<t t-set='searches' t-value="{}"/>
<t t-set='header' t-value="{}"/>
</t> 
</ul>

<t t-set='posts' t-value="request.env['forum.post'].search([('parent_id', '=' , False), ('forum_id', '=', 1)], order='create_date desc', limit=10)"/>
<h1> <t t-esc='len(posts)'/> lastest posts</h1>
<ul t-foreach="posts" t-as='p'>
    <li><span t-field='p.name' /></li>
</ul>

KR

1
Avatar
Zrušit
Nathan Hardwick
Autor

This is exactly what I was after, thanks. I wanted to display some forum posts on another page just as a sort of taste of what is on the forums. I don't suppose you would know how to iterate through the forum posts and only display the first few?

Jérémy Kersten (jke)

Simply use the first example, and design yourself your box.

<t t-set='posts' t-value="request.env['forum.post'].search([('parent_id', '=' , False), ('forum_id', '=', 1)], order='create_date desc', limit=10)"/>

<h1> <t t-esc='len(posts)'/> lastest posts</h1>

<ul t-foreach="posts" t-as='p'>

<li><span t-field='p.name' /></li>

</ul>

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Moving the "My Cart" button along the navbar
xpath website_builder website v10
Avatar
0
srp 17
4908
How do i re-run the website builder to include the demo theme? Vyřešeno
website_builder website
Avatar
Avatar
Avatar
2
zář 25
4644
Adding an HTML element to existing website template
website_builder website
Avatar
Avatar
1
čvc 25
2126
How to add lottie animation to odoo site
website_builder website
Avatar
Avatar
Avatar
2
čvn 25
3507
Website - how to ask for email before allowing download of a pdf Vyřešeno
website_builder website
Avatar
Avatar
Avatar
3
dub 25
3411
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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