Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

When i try to print a custom report i get a InternalError: current transaction is aborted, commands ignored until end of transaction block

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
custom
1 Atsakyti
6818 Rodiniai
Portretas
Erhuvwu Akpobaro

I am getting a tricky error and was wondering of anubody has come across or can help , the error reads :

 File "/opt/odoo/odoo/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
InternalError: current transaction is aborted, commands ignored until end of transaction block

 

 

Module background

the custom module made , create a database view which takes data from other tables(account voucher and account analytic) in the database and displays the infromation, currently  the model persist in odoo and it shows data records i want it to show , however when i print i get the error stated above , also in my report xml file if i leave it blank , i can then print a blank pdf document.

 

Here below is the :

My class :

class cm_sales_receipt(osv.osv):
    _name = "cm.sales.receipt"
    _description = "Camden Market Sales Receipt"
    _auto = False
    _columns = {
        'paymentref':fields.char('PaymentRef'),
        'date':fields.date('Date'),
        'receipt_number':fields.char('Receipt Number'),
        'customer':fields.char('Customer',size=128),
        'unit':fields.char('Unit',size=128),
        'company':fields.char('Name',size=128,required=True),
        'invoicing_company':fields.char('Invoicing Company', size=128,required=True),
        'street':fields.char('Street',size=128,required=True),
        'street2':fields.char('Street2',size=128,required=True),
        'zip':fields.char('Zip',size=10,required=True),
        'state':fields.char('State',size=128,required=True),
        'city':fields.char('City',size=128,required=True),
        'email':fields.char('Email',size=128),
        'fax':fields.integer('Fax'),
        'phone':fields.integer('State'),
        'paid_amount':fields.float('Paid_Amount'),

    }

_order = 'date desc, paid_amount desc'
    def init(self, cr):
        tools.sql.drop_view_if_exists(cr, 'cm_sales_receipt')
        cr.execute("""
            create or replace view cm_sales_receipt as (
                select
                    c.id as id,
                    a.name as customer,
                    c.number as receipt_number,
                    c.reference as PaymentRef,
                    (select e.name from res_company e where c.company_id = e.id) as company,
                    (select f.name from res_company f where a.invcompany_id = f.id) as invoicing_company,
                    (select s.street from res_partner s where s.id = (select w.partner_id from res_company w where id = a.invcompany_id)) as street,
                    (select s.street2 from res_partner s where s.id = (select w.partner_id from res_company w where id = a.invcompany_id)) as street2,
                    (select s.zip from res_partner s where s.id = (select w.partner_id from res_company w where id = a.invcompany_id)) as zip,
                    (select t.name from res_country_state t where t.id = (select s.state_id from res_partner s where s.id = (select w.partner_id from res_company w where id = a.invcompany_id))) as state,
                    (select s.city from res_partner s where s.id = (select w.partner_id from res_company w where id = a.invcompany_id)) as city,
                    (select s.email from res_partner s where a.invcompany_id = s.id) as email,
                    (select s.fax from res_partner s where a.invcompany_id = s.id) as fax,
                    (select s.phone from res_partner s where a.invcompany_id = s.id) as phone,
                    c.amount as paid_amount,
                    c.date as date from
                    account_analytic_account a,
                    account_voucher c where a.partner_id = c.partner_id
                group by
                        c.id,
                        a.name,
                        c.number,
                        c.reference,
                        c.amount,
                        c.company_id,
                        a.invcompany_id,
                        c.date
                         
            )
        """)

Here below is the code used  to print the report (note function is indented so part of above class :

 def print_receipt(self, cr, uid, ids, context=None):
        """
        This function prints the Property Rental Sales receipt
        """
        assert len(ids) == 1, 'This option should only be used for a single id at a time.'
        #self.sent = True
        return self.pool['report'].get_action(cr, uid, ids, 'cm_sales_receipt.report_salesreceipt', context=context)

 

extract from view which has print button (note: print button displays correctly in module:

 <!-- Property Rental Sales Receipt Form View -->
        <record model="ir.ui.view" id="view_cm_sales_receipt_form">
            <field name="name">cm.sales.receipt.form</field>
            <field name="model">cm.sales.receipt</field>
            <field name="arch" type="xml">
                <form string=" Sales Receipt" version="8.0">
                <header>
                    <button name="print_receipt" string="Print Receipt" type="object" class="oe_highlight" groups="base.group_user"/>
                </header>
                                <sheet>
                                <group>
                                        <group>
                                               <field name="invoicing_company"/>
                           <field name="customer"/>
                                               <field name="paymentref"/>
                           <field name="receipt_number"/>
                           <field name="company"/>
                                               <field name="paid_amount"/>
                                    </group>
                                        </group>
                                        </sheet>
                </form>
            </field>
        </record>

 

 

here is the report xml file(note: if i change the model below to account.voucher i can print a report from that model if i use the correct fields , but with the cm.sales.receipt i cannot :

<openerp>
    <data>
        <report
            string="Sales Rental Receipt"
            id="action_cm_report_sales_receipt"
            model="cm.sales.receipt"
            report_type="qweb-pdf"
            name="cm_sales_receipt.report_cm_salesreceipt"
            file="cm_sales_receipt.report_cm_salesreceipt"
            attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('RCPT'+(object.number or '').replace('/','')+'.pdf')"
        />
    </data>
</openerp>

 

 

  1. It seems that the model cannot call the data listed in the created database view
  2. maybe the xml syntax for calling the view is different from when you want call a particular field from  a  module
0
Portretas
Atmesti
Portretas
Osval Reyes
Best Answer

Hi Erhuvwu,

How you handled out this error?

0
Portretas
Atmesti
Erhuvwu Akpobaro
Autorius

Hello Osval , The reason I had this error was because if you look at my code I had a field called units , which was not being populated by the def init(self, cr): function resulting in an error , once I removed this it work.

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

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

Registracija
Related Posts Replies Rodiniai Veikla
Self hosting Odoo custom Solved
custom
Portretas
1
rugp. 24
2797
Add a custom field (for storing domains owned) to a Customer record? Solved
custom
Portretas
Portretas
13
kov. 16
6172
How do i utilize odoo's websocket connection ?
development custom
Portretas
Portretas
1
rugp. 25
2800
How to Add a Custom Button in the Header of Kanban and List Views on the Contact Page in Odoo13?
custom Wizard
Portretas
0
rugp. 24
2224
Add a personal icon
custom icon
Portretas
Portretas
2
rugp. 24
3198
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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