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č

How to create report with init method and graph view?

Naroči se

Get notified when there's activity on this post

This question has been flagged
postgresqlodooV8
1 Odgovori
11364 Prikazi
Avatar
Mohammad Adnan

I create new model for report. this model get its data form other models using select statement in init method. And I use graph view to show this model.

the problem is no data selected.

and graph view show:

No data to display.

No data available for this graph. Try to add some records, or make sure that there is at least one measure and no active filter in the search bar.


please can you help me


doctor_call_report.py

# -*- coding: utf-8 -*-

from openerp import fields, models, api, tools

class dz_all_report(models.Model):

_name = 'dz.all.report'

user_id = fields.Many2one('res.users', ondelete = 'set null', string='Salesperson', index=True)

doctor_id = fields.Many2one('res.partner', ondelete = 'set null', string='Doctor', index=True)

date = fields.Date(string='Date')

nbr_planned_call = fields.Integer(string='Planned Calls')

# nbr_created_call = fields.Integer(string='Created Calls')

def init(self, cr):

tools.drop_view_if_exists(cr, 'dz_all_report_graph')

cr.execute("""

create or replace view dz_all_report_graph as (

select

a.date as date,

a.user_id as user_id,

a.doctor_id as doctor_id,

a.nbr_planned_call as nbr_planned_call

from

dz_calltable a

)""")


doctor_call_report_view.xml

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<record id="dz_all_report_search" model="ir.ui.view">

<field name="name">dz.call.table.report.search</field>

<field name="model">dz.all.report</field>

<field name="arch" type="xml">

<search string="Analytic Entries Analysis">

<field name="date"/>

<field name="doctor_id" />

<field name="user_id"/>

<group expand="0" string="Group By">

<filter string="SalesPersons" context="{'group_by':'user_id'}"/>

<filter string="Doctors" name="Doctors" context="{'group_by':'doctor_id'}" />

<separator/>

<filter string="Month" name="Month" context="{'group_by':'date:month'}"/>

</group>

</search>

</field>

</record>

<record id="dz_all_report_graph" model="ir.ui.view">

<field name="name">dz.report.graph.view</field>

<field name="model">dz.all.report</field>

<field name="arch" type="xml">

<graph string="Analytic Report" type="pivot">

<field name="user_id" type="row"/>

<field name="date" interval="month" type="col"/>

<field name="nbr_planned_call" type="measure"/>

</graph>

</field>

</record>

<record id="dz_all_report_tree" model="ir.ui.view">

<field name="name">dz.report.tree.view</field>

<field name="model">dz.all.report</field>

<field name="arch" type="xml">

<tree string="Tree view" editable="top">

<field name="user_id"/>

<field name="doctor_id" options="{'no_create': True}"/>

<field name="date" widget="date" interval="month"/>

<field name="nbr_planned_call" widget="integer" width="10%"/>

</tree>

</field>

</record>

<record id="dz_all_report_action" model="ir.actions.act_window">

<field name="name">Doctor Call report</field>

<field name="res_model">dz.all.report</field>

<field name="view_type">form</field>

<field name="view_mode">graph,tree</field>

<!--<field name="search_view_id" ref="view_analytic_entries_report_search"/>-->

<!--<field name="context">{'group_by_no_leaf':1, 'search_default_Account':1, 'group_by':[]}</field>-->

<field name="help">Doctor Call Report</field>

</record>

<menuitem action="dz_all_report_action"

id="dz_all_report_menu"

groups="base.group_sale_manager"

parent="base.next_id_64" name="Doctor Call Plan"/>

</data>

</openerp>

0
Avatar
Opusti
Avatar
Axel Mendoza
Best Answer

The data you need is taken from the table dz_calltable, if that table is empty your view will see no data when created or accessed. You need to populate that table to see a result

1
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
How to know how many users are currently logged?
postgresql logging odooV8
Avatar
Avatar
Avatar
2
nov. 15
10182
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
mar. 25
2017
When Odoo 14 connects to PostgreSQL 15.7, the connection is idle but cannot be released
postgresql
Avatar
0
feb. 25
2878
psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied
postgresql
Avatar
Avatar
Avatar
2
jan. 25
10034
How to remove model if not in the py files anymore
odooV8
Avatar
0
jan. 25
4291
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