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

How to show the report in the form view

Abonare

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

Această întrebare a fost marcată
qweb
2 Răspunsuri
15809 Vizualizări
Imagine profil
sridhar

Hi, I need to show and save the report in same form page, how to do that.

2
Imagine profil
Abandonează
Imagine profil
Axel Mendoza
Cel mai bun răspuns

You could do it like this example for sale.order report generated as preview when pressing the preview button:

from openerp import models, fields, api

class report_sale_preview(models.Model):

_inherit = 'sale.order'

preview = fields.Html('Report Preview')

@api.multi

def generate_preview(self):

html = self.env['report'].get_html(self, 'sale.report_saleorder')

self.write({'preview': html})

return True

And in the view

<?xml version="1.0" encoding="UTF-8"?>

<openerp>

<data>

<record model="ir.ui.view" id="solt_report_preview_form_view">

<field name="name">sale.order.report.preview.form</field>

<field name="model">sale.order</field>

<field name="inherit_id" ref="sale.view_order_form"/>

<field name="arch" type="xml">

<xpath expr="//page[1]" position="after">

<page string="Report Preview">

<header>

<button name="generate_preview" type="object" string="Preview"/>

</header>

<sheet>

<field name="preview"/>

</sheet>

</page>

</xpath>

</field>

</record>

</data>

</openerp>

The result is something like this:

4
Imagine profil
Abandonează
awar

how do i do this on odoo 12?

I tried to do the same thing and the result is:

{'context': {'lang': 'en_US', 'tz': 'Europe / Brussels',' uid ': 2,' active_ids': [57]}, 'data': None, 'type': ' ir.actions.report ',' report_name ':' ipc_eoffice.selain_surat_dinas_report ',' report_type ':' qweb-html ',' report_file ':' ipc_eoffice.selain_surat_dinas_report ',' report 'type': 'qweb-html', 'report_file': 'ipc_eoffice.selain_surat_dinas_report', 'report' type: 'qweb-html Report'}

This is my method:

@ api.multi

def print_report (self):

if self.jenis_name in ['Official Letter', 'DINAS LETTER']:

# html = self.env ['web']. get_html (self, 'ipc_eoffice.surat_dinas_report_template')

html = self.env.ref ('ipc_eoffice.surat_dinas_report'). report_action (self)

self.update ({'preview': html})

self.preview = html

# return self.env.ref ('ipc_eoffice.surat_dinas_report'). report_action (self)

html return

Manuel Chirino

When I added that code to my Odoo project when I try to access the report preview I get this error (I have Odoo 15):

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/odoo/src/odoo/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/home/odoo/src/odoo/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 921, in __call__
return self.method(*args, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1328, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1316, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 471, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 456, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/odoo/src/user/camposmc/models/models.py", line 36, in generate_preview
html = self.env['report'].get_html(self, 'sale.report_saleorder')
File "/home/odoo/src/odoo/odoo/api.py", line 552, in __getitem__
return self.registry[model_name]._browse(self, (), ())
File "/home/odoo/src/odoo/odoo/modules/registry.py", line 182, in __getitem__
return self.models[model_name]
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
KeyError: 'report'

Imagine profil
Quang Huynh
Cel mai bun răspuns

Hi Axel,

    Please help do it on ver13

Thanks

0
Imagine profil
Abandonează
Hanane Barrah

Hello,

Try to inherit the form view of the sale.order model and add the following lines:

<xpath expr="//div[hasclass('oe_chatter')]" position="before">

<div class="o_attachment_preview" options="{ 'order': 'desc' }"/>

</xpath>

Regards,

Quang Huynh
Hello,
    Thanks for your reply.
    BTW, do you know how to increase the column width in form/tree view please?
Thanks,


On Tuesday, May 25, 2021, 10:00:28 PM GMT+7, Hanane Barrah <hananbarah@gmail.com> wrote:


Voir Message du forum Odoo S.A.

Hello,

Try to inherit the form view of the sale.order model and add the following lines:

<xpath expr="//div[hasclass('oe_chatter')]" position="before">

<div class="o_attachment_preview" options="{ 'order': 'desc' }"/>

</xpath>

Regards,

Envoyé par Odoo S.A. utilisant Odoo.

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
Odoo 18: Display image from char field containing url in qweb form
qweb
Imagine profil
Imagine profil
1
iul. 25
3252
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Imagine profil
Imagine profil
1
mai 25
4227
QWeb: use t-if to check birthday date Rezolvat
qweb
Imagine profil
Imagine profil
1
apr. 25
3456
Odoo 17 - QWeb Reports with External Datasource Rezolvat
qweb
Imagine profil
Imagine profil
1
feb. 25
2874
Tree line field shrinked/cut
qweb
Imagine profil
0
oct. 24
2326
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