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č

When i click on Print Button RML get error

Naroči se

Get notified when there's activity on this post

This question has been flagged
developmenterrorrml
1 Odgovori
6474 Prikazi
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
Opusti
Avatar
Jagdish Panchal
Best Answer

Hi,

import report in your main 1) __init__.py file

Hope this will help you

1
Avatar
Opusti
Harsh Dhaduk
Avtor

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!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
RML report display problem?
development rml
Avatar
0
mar. 15
4388
safe_eval:cannot eval fuctions.. warning for RML
error rml purchase_order
Avatar
0
mar. 15
6288
How do I deal with the "Invalid XML for View Architecture!" error?
development error view
Avatar
Avatar
Avatar
2
mar. 15
7786
How To Hide User Group From Users Form View In Odoo
development error users group
Avatar
Avatar
Avatar
Avatar
4
sep. 25
2627
odoo 15 development error
development error v15 psycopg2.errors
Avatar
Avatar
1
jul. 24
4720
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