Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Custom qweb report from sql view showing empty

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
qwebcustom
2 Replies
9694 Rodiniai
Portretas
Justice

Dear All,

Am trying to create a qweb report to basically print out a table of all Vehicle service logs using a custom sql view, but my report always shows blank besides the table headers. Am using odoo 10  CE.  not sure what am doing wrong and or help will be greatly appreciated

my fleet.rpt.py

from odoo import fields, models, tools, api
class FleetRptView(models.Model):
  _name = 'fleet.vehicle.report.view'
  _description = 'Custom fleet Report'
  _auto = False
  id = fields.Integer('Service')
  date = fields.Date('Date')
  vehicle = fields.Char('Vehicle Name')
  maintype = fields.Char('Service Description')
  servicetype = fields.Char('ServiceType')
  total = fields.Float('TotalAmt')
  unitprice = fields.Float('UnitPrice')
  odometer = fields.Integer('Odometer')
  service_id = fields.Integer('ServiceId')
  parent_id = fields.Integer('ParentId')
  actotal = fields.Integer('ActualTotal')
  vehicle_id = fields.Integer('VehicleId')
  purchaser_id = fields.Many2one('res.partner','Purchaser')
  vendor_id = fields.Many2one('res.partner','Vendor')
  @api.model_cr
  def init(self):
  tools.drop_view_if_exists(self.env.cr, self._table)
  self.env.cr.execute("""CREATE or REPLACE VIEW %s as ( 
  WITH cte_cost AS(
  SELECT p.id
  ,p.parent_id
  ,t.name as maintype
  ,t2.name as type
  ,p.cost_type
  ,p.amount
  ,c.date
  ,c.name as vehicle
  ,p.vehicle_id
  ,c.odometer_id
  FROM fleet_vehicle_cost c
  JOIN fleet_vehicle_cost p ON c.id=p.parent_id --parent join
  JOIN fleet_service_type t ON c.cost_subtype_id=t.id
  JOIN fleet_service_type t2 ON p.cost_subtype_id=t2.id
  )
  SELECT 
  c.id as id
  ,c.date 
  ,c.vehicle as vehicle
  ,c.maintype as maintype
  ,c.type as servicetype
  ,s.cost_amount as total
  ,c.amount as unitprice
  ,o.value as odometer
  ,s.id as service_id
  ,c.parent_id as parent_id
  ,SUM(c.amount) OVER (PARTITION BY c.parent_id) as actotal
  ,c.vehicle_id
  ,s.purchaser_id
  ,s.vendor_id
  FROM fleet_vehicle_log_services s
  JOIN cte_cost c ON s.cost_id=c.parent_id and cost_type='services'
  LEFT JOIN fleet_vehicle_odometer o ON c.odometer_id=o.id
  ORDER BY c.date desc, c.id,c.parent_id
  )""" % (self._table))


report xml: fleet_report.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
  <report id="action_fleet_rpt_report"
  string="Custom Fleet Report"
  model="fleet.vehicle.report.view"
  report_type="qweb-html"
  name="fleet_rpt.rpt_template"
  />
  <template id="rpt_template">
  <t t-call="report.html_container">
  <t t-call="report.external_layout">
  <div class="page">
  <table class="table table-striped">
  <tr>
  <th>Date </th>
  <th>Vehicle </th>
  <th>Type of Service </th>
  <th>km Covered </th>
  <th>Problem/ Service details</th>
  <th>Unit Price</th>
  <th>Total</th>
  </tr>
  <t t-foreach="docs" t-as="o">
  <tr>
  <td>
  <span t-field="o.date" />
  </td>
  <td>
  <span t-field="o.vehicle"/>
  </td>
  <td>
  <span t-field="o.maintype"/>
  </td>
  <td>
  <span t-field="o.odometer"/>
  </td>
  <td>
  <span t-field="o.servicetype"/>
  </td>
  <td>
  <span t-field="o.unitprice"/>
  </td>
  </tr>
  </t>
  </table>
  </div>
  </t>
  </t>
  </template>
</odoo>
0
Portretas
Atmesti
Portretas
Justice
Autorius Best Answer

Thanks Sehrish for the response.  Could you provide some more info on how i can do that please. I did follow a couple of tutorials but didn't manage to get it to work. Thanks

0
Portretas
Atmesti
Sehrish

check out below links

1- http://learnopenerp.blogspot.com/2016/11/how-to-create-qweb-reports-in-openerp.html

2- http://learnopenerp.blogspot.com/2016/09/how-to-create-custom-reports-in-odoo.html

Hope its help you.

Portretas
Sehrish
Best Answer

I think You are not rendering your data into template.

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

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

Registracija
Related Posts Replies Rodiniai Veikla
Why openERP don't find my custom View ?
views qweb custom
Portretas
Portretas
Portretas
2
kov. 15
6932
odoo custom homepage issue redirection
qweb custom website
Portretas
0
kov. 15
4198
Odoo 18: Display image from char field containing url in qweb form
qweb
Portretas
Portretas
1
liep. 25
3122
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Portretas
Portretas
1
geg. 25
4103
QWeb: use t-if to check birthday date Solved
qweb
Portretas
Portretas
1
bal. 25
3393
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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