Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Problem with env[].search in xml template

Odoberať

Get notified when there's activity on this post

This question has been flagged
developmentxmlpluginodoo16features
1 Odpoveď
3483 Zobrazenia
Avatar
Hippolyte Lacour

 I am working with odoo 16 and i have this line in a template xml:

  t t-set="payment_provider_model" t-value="request.env['payment.provider'].search([('id', '=', self.id)])[0]"/

(I know it's missing but i can't put my post correctly with them)

The objective of this line is to get me the possibility to use the differant function in my payment_provider class.




The error i get is the following :

"Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo16\server\odoo\http.py", line 2003, in __call__
    response = request._serve_db()
  File "C:\Program Files (x86)\Odoo16\server\odoo\http.py", line 1589, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "C:\Program Files (x86)\Odoo16\server\odoo\service\model.py", line 133, in retrying
    result = func()
  File "C:\Program Files (x86)\Odoo16\server\odoo\http.py", line 1616, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "C:\Program Files (x86)\Odoo16\server\odoo\http.py", line 1730, in dispatch
    return self.request.registry['ir.http']._dispatch(endpoint)
  File "C:\Program Files (x86)\Odoo16\server\odoo\addons\website\models\ir_http.py", line 237, in _dispatch
    response = super()._dispatch(endpoint)
  File "C:\Program Files (x86)\Odoo16\server\odoo\addons\base\models\ir_http.py", line 156, in _dispatch
    result.flatten()
  File "C:\Program Files (x86)\Odoo16\server\odoo\http.py", line 1100, in flatten
    self.response.append(self.render())
  File "C:\Program Files (x86)\Odoo16\server\odoo\http.py", line 1092, in render
    return request.env["ir.ui.view"]._render_template(self.template, self.qcontext)
  File "C:\Program Files (x86)\Odoo16\server\odoo\addons\website\models\ir_ui_view.py", line 419, in _render_template
    return super()._render_template(template, values=values)
  File "C:\Program Files (x86)\Odoo16\server\odoo\addons\base\models\ir_ui_view.py", line 2125, in _render_template
    return self.env['ir.qweb']._render(template, values)
  File "C:\Program Files (x86)\Odoo16\server\odoo\tools\profiler.py", line 292, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "C:\Program Files (x86)\Odoo16\server\odoo\addons\base\models\ir_qweb.py", line 581, in _render
    result = ''.join(rendering)
  File "", line 369, in template_1710
  File "", line 351, in template_1710_content
  File "", line 251, in template_1710_t_call_0
  File "", line 876, in template_1285
  File "", line 663, in template_1285_content
  File "", line 67, in template_1784
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
KeyError: 'self'



I want to replace the self.id with something that will not raise an error but give me the actual id of my actual payment_provider




0
Avatar
Zrušiť
Avatar
Hippolyte Lacour
Autor Best Answer

Found a way, instead of using the id i used the code : 

t t-set="payment_provider_model" t-value="request.env['payment.provider'].search([('code', '=', 'mycode')])"/> 

worked perfectly 

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Problem with an invisible condition in an XML template file
xml plugin odoo16features
Avatar
1
apr 24
2888
Module doesn't update after modification in the source code
development plugin bug odoo16features
Avatar
Avatar
2
apr 24
4011
How to get the amount of the cart on the checkout page
development plugin checkout odoo16features
Avatar
0
feb 24
1895
Looking for a specific function to overide in a payment plugin
development python plugin odoo16features
Avatar
0
feb 24
1955
Passing variable from a .py to a .xml views for a payment plugin
xml payment plugin odoo16features
Avatar
Avatar
2
jan 24
2613
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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