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

Retrieving all records from a table with mako templates

Odoberať

Get notified when there's activity on this post

This question has been flagged
webkitmakoreports
5085 Zobrazenia
Avatar
Santiago J. Said

Hi folks, I want to know how can i get all records of a table from my openerp 7 with mako templates(to show it in my report). As far I know, in my mako template i have an iterable called objects which is a browse_record(suri.flete.items_recorrida, 1).

My question is how can i get all the records of the table "suri.flete.items_recorrida", and then only show in the report the items which values en_recorrida and finalizado are False.

In my mako template(flete_rep_webkit.mako):

    %for item in objects:
        <tr>
            <td>${item.descripcion}</td>
            <td>${item.origen.nombre}(${item.origen.direccion},${item.origen.localidad})</td>
            <td>${item.destino.nombre}, (${item.destino.direccion},${item.destino.localidad})</td>
        </tr>
    %endfor

In my parser .py file(flete_webkit.py)

import time
from report import report_sxw
from osv import osv

class flete_webkit(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(flete_webkit, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'cr':cr,
            'uid': uid,
        })        

report_sxw.report_sxw('report.webkit.flete_items_recorrida',
                           'suri.flete.items_recorrida', 
                           '/suri/flete/report/flete_rep_webkit.mako',
                           parser=flete_webkit)

In my view

<report auto="False" id="flete_webkit" model="suri.flete.items_recorrida" name="webkit.flete"  file="suri/flete/report/flete_rep_webkit.mako" string="Reporte prueba" report_type="webkit" />

In my .py file (flete.py)

class items_recorrida(osv.osv):        
    _name = "suri.flete.items_recorrida"
    _columns = {
        'name' : fields.related('descripcion', 'name', type="many2one", relation="suri.flete.items_recorrida", string='Descripcion',context="{'form_view_ref' : 'suri.flete.formulario_flete_items_recorrida', 'tree_view_ref' : 'suri.flete.arbol_flete_items_recorrida'}"),
        'estado' : fields.boolean('Estado', required=True),
        'descripcion' : fields.char('Descripcion', size=128, required = True),
        'documentacion' : fields.char('Documentacion', size=128, required = False),
        'origen': fields.many2one('res.partner.sedes','Origen', required=True),#FK->res.partner.sedes
        'destino': fields.many2one('res.partner.sedes','Destino', required=True),#FK->res.partner.sedes
        'pedido_por': fields.many2one('res.users','Pedido por', required=True),#FK->res.users
        'id_flete': fields.many2one('suri.flete.recorrida','Numero de flete',required=False),#FK->suri.flete.recorrida        
        'nota': fields.char('Nota',size=128,required=False),
        'proyecto': fields.many2one('suri.proyectos.proyecto','Proyecto',required=False),#FK->suri.proyectos.proyecto
        'dimension': fields.char('Dimension Estimada', size=128, required = False),
        'peso': fields.char('Peso Estimado', size=128, required = False),
        'fragil': fields.boolean('Es fragil?', required=False),
        'urgente': fields.boolean('Es urgente?', required=False),
        'en_recorrida': fields.boolean('Esta en recorrida?', required=False,),
        'finalizado': fields.boolean('Esta finalizado?', required=False,) 
    }

    _defaults = {
    'en_recorrida' : False,
    'finalizado' : False,      
    }

    _rec_name = 'descripcion'

Thanks in advance.

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
Missing headers in webkit/mako report PDFs Solved
webkit mako reports
Avatar
Avatar
Avatar
Avatar
3
mar 15
12172
Images in webkit / mako pdf reports Solved
webkit mako
Avatar
Avatar
Avatar
Avatar
4
sep 16
9090
how to use dynamic file name for webkit report?
webkit reports
Avatar
0
mar 15
4650
How do I limit an iteration in Mako?
webkit mako
Avatar
Avatar
1
mar 15
5900
how to use dynamic file name for webkit report?
webkit reports
Avatar
0
mar 15
3935
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