Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

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

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

Odoo V8 problem: Custom Module inheriting account.invoice still loads standard invoice template - what am I doing wrong?

Subscribe

Get notified when there's activity on this post

This question has been flagged
v8modulesinheritancereportingaccount.invoice
3 Replies
7939 Views
Avatar
NSC

My issue, see above... I created a custom module while studying some information about that in the web. But yet without any real success... I can install my module without any error messages and the appropriate menu entry appears in account.invoice view, but when pressing it, the old standard template is shown and not my own report template which is inside my external module. Can you tell me why not? I think, I did not do anything other than in former times for OpenERP v7, only considering API and report engine changes of Odoo v8.

What I have not yet understood, is how new report engine has to find my .xml report template (which replaces old .rml one). One of the blog entries I read about that claims, this template needs to be in folder "views" inside my module folder (not any more in folder "reports" like before with RML reporting) and that it is found there via its template_id. I did so - I put it there, but obviously, it is NOT found this way. But no example in the web regarding that issue uses an entire path to this report template like before with rml! Can anybody explain me how I have to "explain" the module where my own report template is located?

I used these tutorials as a base (sorry, I did not manage to insert them as links - this did not work; dunno why not):

http://www.zbeanztech.com/blog/qweb-report

http://blog.emiprotechnologies.com/create-qweb-report-odoo/


Here are some code sequences (please tell me where they are erroneous or incompatible with Odoo V8):

Report Parser and simple minimal report template to get started:

# -*- coding: utf-8 -*-
##############################################################################
# Modification of standard invoice template
##############################################################################

import time
from openerp.report import report_sxw
from openerp.osv import osv

class my_account_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(fq_account_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})

#remove previous sale.report service :
#from netsvc import Service
#del Service._services['account.report_invoice']

class myreportinvoice(osv.AbstractModel): #individual name, but extending osv.AbstractModel
_name = 'report.account.report_invoice' #_name = ‘report.<module_name>.<report_name>’
_inherit = 'report.abstract_report'
_template='account.report_invoice' #_template = ‘<module_name>.<report_name>’
_wrapped_report_class=my_account_invoice #_wrapped_report_class = <parser_class_name>

<template id="report_invoice">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.external_layout">
<div class="page">
<h2>New Invoice Template</h2>
<p>This object's name is <span t-field="o.name"/></p>
</div>
</t>
</t>
</t>
</template>

Menu Entry:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
id="my_account_invoices"
model="account.invoice"
string="My New Invoice"
report_type="qweb-pdf"
name="account.report_invoice"
file="account.report_invoice"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
attachment_use="False"
/>
</data>
</openerp>

If I replace the original ID 'report_invoice' to an own, individual one, for example 'report_my_invoice', I get the following error:
QWebTemplateNotFound: External ID not found in the system: account.report_my_invoice

But in settings --> reports, it looks like my new report is registered in a right way: The old original one has its own views, and my new one, too. Looks good, so far, but nevertheless, I can not print it because of this error. If it is registered with this ID in settings --> reports, why this error? Any idea ???



2
Avatar
Discard
Avatar
David Bertha
Best Answer

The module name should be your module name, not the name of the inherited module.

What's in your __openerp__.py file ?

I made a custom report for invoice too :

report_group_invoice.xml :

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_group_invoice_document">
...
</template>
<template id="report_group_invoice">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'delivery_carrier_pickingup.report_group_invoice_document')"/>
</t>
</t>
</template>
</data>
</openerp>


report.xml :


<report 
id="delivery_grouped_invoice"
model="account.invoice"
string="Grouped invoice"
report_type="qweb-pdf"
name="delivery_carrier_pickingup.report_group_invoice"
file="delivery_carrier_pickingup.report_group_invoice"
attachment_use="True"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
/>

Those 2 files are in the "data" list of my openerp.py file

If you want to add arguments to the qweb engine :


class GroupedInvoiceReport(models.AbstractModel):
_name = 'report.delivery_carrier_pickingup.report_group_invoice'
def render_html(self, cr, uid, ids, data=None, context=None):
"""Add period start and period end from context to args of report template"""
if context is None :
    context= {}
report_obj = self.pool['report']
report = report_obj._get_report_from_name(cr, uid, 'delivery_carrier_pickingup.report_group_invoice')
docargs = {
'doc_ids': ids,
'doc_model': report.model,
'docs': self.pool.get('account.invoice').browse(cr,uid, ids,context=context),
}
docargs.update(<arguments>)
return report_obj.render(cr, uid, ids, 'delivery_carrier_pickingup.report_group_invoice', docargs, context=context)

My answer to NSC :
A report entry (with the <report/> tag) define a report, not a menu entry : https://www.odoo.com/documentation/8.0/reference/reports.html


1
Avatar
Discard
NSC
Author

Okay then, maybe pointing out this misunderstanding of mine has already cleared up my mind for that - if report-tag is not only for menu entry but all the report definition, then model-tag inside seems to be underlying data source for it...

Avatar
NSC
Author Best Answer

This is an answer of @David Bertha's post - I can do what I want; it will not appear under the post it refers to :(:

Thank you for this, David! I think, you have just acknowledged what I found out later in the night! When refering to my own module overall and not any more to account, I was able to load my minimal template to get started when pressing the menu item! The only location left where I referenced account model is model field in menu entry (report.xml in your example). But this is only for the menu to know where to appear, isn't it?

What I am still wondering about is, how the module can know which data models it can access... I have not yet accessed any field for account.invoice in my getting-started-minimal-template (it is still nothing else than a skeleton), but I will try later on, if I can access any field.

In every case, if the "original" id/model should not be referenced, this does not definitely seem to be a "real" inheritance mechanism, but full autonomism of custom report module. The only question left for me would then be the one mentioned above - how to specify which data models the module may access. Could you, @David Bertha (or anybody else) clear up my mind regarding that?


//Edit:

Problem solved by only referencing to own module name and not the one of the model I wish to use data from in my report

1
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
Model inheriance, how to override a default model in a module?
modules inheritance account.invoice model
Avatar
0
जन॰ 21
3510
How to get rid of the product name in account.invoice.line.name?
v8 modules invoice account.invoice account.invoice.line
Avatar
1
अप्रैल 16
6525
how to overide abstract model method Solved
inheritance reporting
Avatar
1
दिस॰ 22
2866
Inherit without changing original module
modules inheritance
Avatar
Avatar
Avatar
5
अक्तू॰ 20
8154
Invoice report is displaying an incorrect value Solved
v8 reporting
Avatar
Avatar
Avatar
4
अक्तू॰ 16
7339
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة 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, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

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