Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

NoneType' object is not callable" while evaluating

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
posxmlpython2.7odoo8
3 Răspunsuri
19721 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Axel Mendoza
Cel mai bun răspuns

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
Imagine profil
Abandonează
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

Imagine profil
Akhil P Sivan
Cel mai bun răspuns

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
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to change the text color/font color in kanban view depending on a field value in odoo 10?
xml python2.7
Imagine profil
Imagine profil
Imagine profil
2
sept. 23
5981
Remove "add an item" Rezolvat
xml python2.7
Imagine profil
Imagine profil
Imagine profil
12
oct. 23
36933
Pivot view does not display in odoo 8 Rezolvat
python2.7 odoo8
Imagine profil
Imagine profil
1
oct. 22
6233
extraction attribute with: amount_python_compute
xml python2.7
Imagine profil
Imagine profil
2
mar. 15
7153
<field name="amount_python_compute">
xml python2.7
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
mar. 15
6254
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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