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

When i click on Print Button RML get error

Subscriure's

Get notified when there's activity on this post

This question has been flagged
developmenterrorrml
1 Respondre
6478 Vistes
Avatar
Harsh Dhaduk

Hello, Friends

i created one module testing purpose to generate blank pdf file to open. but something i missed and when i press print button then error come

so can you help me how can i fix.

Thanks In Advance

Error Come Like This

report.hd.wizard

type 'exceptions.KeyError', KeyError(u'report.hd.wizard', traceback object at 0xc9b6b44

directory structure like this

hd_report

  • __init__.py
  • __openerp__.py
  • hd_wizard.py
  • hd_wizard_view.xml
  • report 1.__init__.py 2.hd_report.py 3.hd_report.rml 4.hd_r

eport.sxw

1)__init__.py

import  hd_wizard

2)__openerp__.py

{
     'name': 'HD Report Wizard',
     'version': '1.0',
     'category': 'General',
    'author': 'Harsh Dhaduk',
    'depends': ['sale', 'point_of_sale'],
    'data': [ "hd_wizard_view.xml" ],
    'installable': True,   
    'active': False,

}

3)hd_wizard.py

from openerp.osv import fields, osv from openerp.tools.translate import _ import time

class hd_wizard(osv.osv_memory):
    _name = "hd.wizard"

    def get_start_date(self, cr, uid, context=None):
        start_date = time.strftime('%Y') + '-01-01'
        return start_date

    _columns = {
        'start_date': fields.date('Start Date',

required=True), 'end_date': fields.date('End Date', required=True), 'all_shops': fields.boolean('All Shops'), 'shop_ids': fields.many2many('sale.shop', 'rel_wizard_shop', 'wizard_id', 'shop_id', 'Shops'), } _defaults = { 'start_date': get_start_date, 'end_date': time.strftime('%Y-%m-%d'), }

    def print_report(self, cr, uid, ids, context=None):
        record = self.read(cr, uid, ids[0], context=context)
        datas = {
             'model': 'hd.wizard',
             'ids': ids,
             'form': record,
        }
        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'hd.wizard',
            'datas': datas,
            'nodestroy': True            
        }

hd_wizard()

4) hd_wizard_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_hd_wizard_form" model="ir.ui.view">
            <field name="name">view.hd.wizard.form</field>
            <field name="model">hd.wizard</field>
            <field name="arch" type="xml">
                <form string="HD Report Wizard" version="7.0">
                    <group col="4" colspan="4">
                        <field name="start_date"/>
                        <field name="end_date"/>
                    </group>
                    <group col="4" colspan="4">
                        <field name="all_shops"/>
                    </group>
                    <group colspan="4">
                        <field name="shop_ids" nolabel="1" attrs="{'readonly': [('all_shops', '=', True)]}"/>
                    </group>
                    <footer>
                        <button name="print_report" string="Print" type="object" class="oe_highlight"/>
                        <button string="Cancel" class="oe_link" special="cancel"/>
                    </footer>
                </form>
           </field>
        </record>

        <record id="action_hd_wizard" model="ir.actions.act_window">
            <field name="name">HD Wizard</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">hd.wizard</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
            <field name="view_id" ref="view_hd_wizard_form"/>
        </record>

        <menuitem action="action_hd_wizard" id="menu_hd_wizard" 
                  parent="base.next_id_64"/>

        <report
            auto="False"
            id="hd_report_custome"
            model="hd.wizard" 
            name="hd.report"
            rml="hd_report/report/hd_report.rml"
            string="Custome Report ..." 
            header="False"/>

    </data>
</openerp>

5)report->__init__.py

import hd_report

6)report->hd_report.py

import time
from common_report_header import common_report_header
from openerp.report import report_sxw

class hd_report(report_sxw.rml_parse, common_report_header):
    def __init__(self, cr, uid, name, context):
        super(hd_report, self).__init__(cr, uid, name, context)
        self.localcontext.update({

        })

report_sxw.report_sxw('hd.report', 'hd.wizard', 'addons/hd_report/report/hd_report.rml', parser = hd_report,header="external")
1
Avatar
Descartar
Avatar
Jagdish Panchal
Best Answer

Hi,

import report in your main 1) __init__.py file

Hope this will help you

1
Avatar
Descartar
Harsh Dhaduk
Autor

i tried but same error come report.hd.wizard type 'exceptions.KeyError', KeyError(u'report.hd.wizard', traceback object at 0xc9b6b44

Jagdish Panchal

Try this: report_sxw.report_sxw('report.hd.report', 'hd.wizard', 'addons/hd_report/report/hd_report.rml', parser = hd_report,header="external")

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
RML report display problem?
development rml
Avatar
0
de març 15
4394
safe_eval:cannot eval fuctions.. warning for RML
error rml purchase_order
Avatar
0
de març 15
6289
How do I deal with the "Invalid XML for View Architecture!" error?
development error view
Avatar
Avatar
Avatar
2
de març 15
7786
How To Hide User Group From Users Form View In Odoo
development error users group
Avatar
Avatar
Avatar
Avatar
4
de set. 25
2633
odoo 15 development error
development error v15 psycopg2.errors
Avatar
Avatar
1
de jul. 24
4723
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