Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to create report with init method and graph view?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
postgresqlodooV8
1 Respondre
11332 Vistes
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
Descartar
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
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
How to know how many users are currently logged?
postgresql logging odooV8
Avatar
Avatar
Avatar
2
de nov. 15
10151
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
de març 25
1997
When Odoo 14 connects to PostgreSQL 15.7, the connection is idle but cannot be released
postgresql
Avatar
0
de febr. 25
2813
psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied
postgresql
Avatar
Avatar
Avatar
2
de gen. 25
9929
How to remove model if not in the py files anymore
odooV8
Avatar
0
de gen. 25
4251
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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