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č

NoneType' object is not callable" while evaluating

Naroči se

Get notified when there's activity on this post

This question has been flagged
posxmlpython2.7odoo8
3 Odgovori
19718 Prikazi
Avatar
Ranga Dharmapriya

Hello,

I'm try to create Invoive copy receipt from POS screesn. but when I try to print bill I got this error.


NoneType' object is not callable" while evaluating 'get_journal_amt(o)' 


 import time

from openerp.osv import osv

from openerp.report import report_sxw

def titlize(journal_name):
    words = journal_name.split()
    while words.pop() != 'journal':
        continue
    return ' '.join(words)

class family_order(report_sxw.rml_parse):

    def __init__(self, cr, uid, name, context):

        super(family_order, self).__init__(cr, uid, name, context=context)
        user = self.pool['res.users'].browse(cr, uid, uid, context=context)
        partner = user.company_id.partner_id
        self.localcontext.update({
            'time': time,
            # 'disc': self.discount,
            'net_amount': self._netamount,
            'get_journal_amt': self._get_journal_amt,
            # 'get_journal_amt': self._get_journal_amt,
            'address': partner or False,
            'titlize': titlize
        })


def _netamount(self):
 res = {'name': 'hello'} return res def _get_journal_amt(self, order_id): data={} sql = """ select aj.name,absl.amount as amt from account_bank_statement as abs LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id LEFT JOIN account_journal as aj ON aj.id = abs.journal_id WHERE absl.pos_statement_id =100""" self.cr.execute(sql, order_id) data = self.cr.dictfetchall() return data class bill_copy_report(osv.AbstractModel): _name = 'report.point_of_sale.bill_copy' _inherit = 'report.abstract_report' _template = 'point_of_sale.bill_copy' _wrapped_report_class = family_order # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # -*- coding: utf-8 -*-
##############################################################################


<?xml version="1.0" encoding="utf-8"?> 
<openerp>
<data>
<template id="bill_copy">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<div class="page">
<div class="row">
<div class="col-xs-12 text-center">
<span t-field="o.table_id"/>
Hello
<table class="table table-condensed">
<thead>
<tr>
<th>Description</th>
<th class="text-right">Quantity</th>
<th class="text-right">Price</th>
</tr>
</thead>
<!--<tbody>-->
<!--&lt;!&ndash;<tr t-foreach ="o.lines" t-as="line">&ndash;&gt;-->
<!--&lt;!&ndash;<td><span t-field="line.name"/></td>&ndash;&gt;-->
<!--&lt;!&ndash;</tr>&ndash;&gt;-->

<!--<tr t-foreach="net_amount()" t-as="d">-->
<!--<td>-->
<!--<span t-esc="d['product_id']"/>-->
<!--</td>-->
<!--</tr>-->

<!--</tbody>-->
<tbody>
<tr t-foreach="get_journal_amt(o)" t-as="d">
<td>
<span t-esc="d['name']"/>
</td>
<td>
<span t-esc="formatLang(d['amt'], currency_obj=res_company.currency_id)"/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</t>
</t>
</template>
</data>
</openerp>


Anyone know how to resolve this ?

Thank you...

0
Avatar
Opusti
Avatar
Axel Mendoza
Best Answer

You have two options to get it fixed:

1- Rename your template id to be:

<template id="point_of_sale.bill_copy">

or

2- Change this to match report name/id:

class bill_copy_report(osv.AbstractModel):
_name = 'report.bill_copy'
_inherit = 'report.abstract_report'
_template = 'bill_copy'
_wrapped_report_class = family_order
2
Avatar
Opusti
Axel Mendoza

See more at:
https://www.odoo.com/es_ES/forum/help-1/question/how-to-define-a-custom-methods-functions-to-be-used-in-a-qweb-report-how-to-define-and-use-a-report-parser-92244

Avatar
Akhil P Sivan
Best Answer

Hi,

That means your function _get_journal_amt() is not returning anything as something wrong with the query or execute command.

Why are you passing order_id in self.cr.execute(), as you are not using that in your sql statement:

def _get_journal_amt(self, order_id):
data={}
sql = """ select aj.name,absl.amount as amt from account_bank_statement as abs
LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
WHERE absl.pos_statement_id =100"""
self.cr.execute(sql, order_id)
data = self.cr.dictfetchall()
return data

Try without order_id and also ensure your query is correct. Print data on terminal and check whether you are getting the records with your query.

2
Avatar
Opusti
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
How to change the text color/font color in kanban view depending on a field value in odoo 10?
xml python2.7
Avatar
Avatar
Avatar
2
sep. 23
5981
Remove "add an item" Solved
xml python2.7
Avatar
Avatar
Avatar
12
okt. 23
36933
Pivot view does not display in odoo 8 Solved
python2.7 odoo8
Avatar
Avatar
1
okt. 22
6230
extraction attribute with: amount_python_compute
xml python2.7
Avatar
Avatar
2
mar. 15
7153
<field name="amount_python_compute">
xml python2.7
Avatar
Avatar
Avatar
Avatar
4
mar. 15
6253
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