Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    • Referral Program
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Batch Report using Report Parser?

Subscribe

Get notified when there's activity on this post

This question has been flagged
qwebreportparseraccount.voucher
2 Replies
6367 Views
Avatar
Samantha Cruz

How can I do ths kind of report in QWEB? All the selected payments should be in one page only. Is there a way to do this?


PAGE 1

Transaction Date
Check Date
Bank
Check #

Customret

02/12/16
02/18/16
Bank1
0123
Cust1
02/16/16
02/29/16
Bank2
4561

Cust2

02/18/16
02/25/16
Bank3
7548Cust3

0
Avatar
Discard
Avatar
Axel Mendoza
Best Answer

Hi Samantha

Your error is due to this line:

'get_data': self._get_data(voucher), 

because you are getting the result of the _get_data method call and assign it to the localcontext dict. Change it to:

'get_data': self._get_data, 

And you will be ok. The localcontext is were you put some info available to the report and for function calls in the report you need to use the function object reference

1
Avatar
Discard
Avatar
Samantha Cruz
Author Best Answer

I can't edit my question.


This is my code (as of now) but it returns an error: 

QWebException: ""'account.voucher.pay.detail' object is not callable" while evaluating
'get_data(o)'" while evaluating


report_parser.py


from openerp import models
from openerp.report import report_sxw

class report_parser(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pdc_report_parser, self).__init__(cr, uid, name, context=context)
active_ids = context.get('active_ids')
account_voucher = self.pool.get('account.voucher')
docs = account_voucher.browse(cr, uid, active_ids, context)

voucher = []
for voucher_id in active_ids:
voucher_id = account_voucher.browse(cr, uid, voucher_id, context)
voucher.append(voucher_id)

self.localcontext.update({
'docs': docs,
'get_data': self._get_data(voucher),
'hello_world': self._hello,
})

def _hello(self):
return "Hello World!"

#It returns all ids of the object 'account.voucher.pay.detail' based on voucher_ids that was selected
def _get_data(self, voucher_id):
print "voucher_id:", voucher_id
pay_details = []
account_voucher_pay_detail = self.pool['account.voucher.pay.detail']

for rec in voucher_id:

details = account_voucher_pay_detail.search(self.cr, self.uid,
[('voucher_id', '=', rec.id)])
if details:
pay_details = pay_details + details
 
pay_details = account_voucher_pay_detail.browse(self.cr, self.uid, pay_details)
return pay_details

class pdc_report_parser_test(models.AbstractModel):
_name = 'report.parser_module.report_test_document'
_inherit = 'report.abstract_report'
_template = 'parser_module.report_test_document'
_wrapped_report_class = report_parser


report_test_document.xml


<?xml version="1.0" encoding="utf-8"?>
<!--Custom report.-->
<openerp>
<data>
<template id="report_test_doc">
<t t-call="module_parser.my_layout">
<div class="page">
<table class="table table-condensed">
<thead>
<tr>
<th>Transaction Date</th>
<th>Check Date</th>
<th>Bank/Branch</th>
<th>Check No.</th>
<th>Amount</th>
<t t-if="o.partner_id.customer">
<th>Customer</th>
</t>
<t t-if="o.partner_id.supplier">
<th>Supplier</th>
</t>
</tr>
</thead>
 
<tr t-foreach="get_data(o)" t-as="pd">
<td>
<span t-field="o.date"/>
</td>
<td>
<span t-field="pd.date_due"/>
</td>
<td>
<span t-field="pd.name"/>
</td>
<td>
<span t-field="pd.check_no"/>
</td>
<td>
<span t-field="pd.amount"/>
</td>
<td>
<span t-field="o.partner_id.name"/>
</td>
</tr>
</table>
</div>
</t>
</template>
<template id="report_test_document">
<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', 'module_parser.report_test_doc')"/>
</t>
</t>
</template>
</data>
</openerp>


In the default, it can print all necessary information but per page (1 voucher, 1 page) not in one page only (all vouchers selected in one page)

0
Avatar
Discard
Alaa Ahmed

i have the same error have you found any solution ??

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
odoo 16 report target new page scss
qweb report
Avatar
Avatar
1
Apr 25
4394
Missing external identifier on new external layout template Solved
qweb report
Avatar
Avatar
2
Mar 25
5082
Translate month name in t-esc Qweb report Solved
qweb report
Avatar
Avatar
Avatar
Avatar
Avatar
4
Nov 24
10245
QWeb Report Shows Different When Edit And Print Review Solved
qweb report
Avatar
Avatar
1
Mar 24
4881
How display the currency symbol before the subtotal value on Quotation report? Solved
qweb report
Avatar
Avatar
Avatar
3
Sep 23
27913
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 Svenska ภาษาไทย 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