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č

Retrieving all records from a table with mako templates

Naroči se

Get notified when there's activity on this post

This question has been flagged
webkitmakoreports
5082 Prikazi
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
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
Missing headers in webkit/mako report PDFs Solved
webkit mako reports
Avatar
Avatar
Avatar
Avatar
3
mar. 15
12166
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
4648
How do I limit an iteration in Mako?
webkit mako
Avatar
Avatar
1
mar. 15
5899
how to use dynamic file name for webkit report?
webkit reports
Avatar
0
mar. 15
3933
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