İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

ODOO 12 how can we generate Excel report

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
excel
7 Cevaplar
16556 Görünümler
Avatar
Hoang Quan


Hello,

I want to generate excel report on button click, can any one help me out how this can be done. I'm using odoo 12

Thanks 


0
Avatar
Vazgeç
Avatar
Jignesh Mehta
En İyi Yanıt

Hello Hoang Quan,


Please find below code for the excel report of particular product. Add button in Product form view with method name "product_template_excel_report".

PY File :-
==========

from odoo import models, fields, api, _
from odoo.exceptions import UserError
from datetime import date, timedelta, datetime
import datetime
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
import tempfile
from odoo.tools.misc import xlwt
import io
import base64
import time
from dateutil.relativedelta import relativedelta
from pytz import timezone

class ProductTemplate(models.TransientModel):
    _inherit = 'product.template'

    @api.multi
    def product_template_excel_report(self):
        filename= 'Product Report ' + str(self.name) + '.xls'
        workbook= xlwt.Workbook()

        worksheet= workbook.add_sheet('Product Report')
        font = xlwt.Font()
        font.bold = True
        for_left = xlwt.easyxf("font: bold 1, color black; borders: top double, bottom double, left double, right double; align: horiz left")
        for_left_not_bold = xlwt.easyxf("font: color black; align: horiz left")
        for_center_bold = xlwt.easyxf("font: bold 1, color black; align: horiz center")
        GREEN_TABLE_HEADER = xlwt.easyxf(
            'font: bold 1, name Tahoma, height 250;'
            'align: vertical center, horizontal center, wrap on;'
            'borders: top double, bottom double, left double, right double;'
            )
        style = xlwt.easyxf('font:height 400, bold True, name Arial; align: horiz center, vert center;borders: top medium,right medium,bottom medium,left medium')

        alignment = xlwt.Alignment()  # Create Alignment
        alignment.horz = xlwt.Alignment.HORZ_RIGHT
        style = xlwt.easyxf('align: wrap yes')
        style.num_format_str = '0.00'

         worksheet.row(0).height = 320
        worksheet.col(0).width = 4000
        worksheet.col(1).width = 4000
        borders = xlwt.Borders()
        borders.bottom = xlwt.Borders.MEDIUM
        border_style = xlwt.XFStyle()  # Create Style
        border_style.borders = borders

        product_title = 'Product Report ' + str(self.name)
        worksheet.write_merge(0,1,0,2,product_title,GREEN_TABLE_HEADER)

        row = 2

         worksheet.write(row, 0, 'Product Name' or '',for_left)
        worksheet.write(row, 1, 'Sales Price' or '',for_left)

        row = row + 1
        worksheet.write(row, 0, self.name or '',for_left_not_bold)
        worksheet.write(row, 1, self.list_price or '',for_left_not_bold)

        fp = io.BytesIO()
        workbook.save(fp)
        product_id = self.env['product.excel.extended'].create({'excel_file': base64.encodestring(fp.getvalue()), 'file_name': filename})
        fp.close()

        return{
            'view_mode': 'form',
            'res_id': product_id.id,
            'res_model': 'product.excel.extended',
            'view_type': 'form',
            'type': 'ir.actions.act_window',
             'context': self._context,
             'target': 'new',
         }


class ProductExcelExtended(models.Model):
        _name = 'product.excel.extended'
        _description = "Product Excel Extended"

         excel_file = fields.Binary('Download Report :- ')
         file_name = fields.Char('Excel File', size=64)



XML File :-
===========

<?xml version="1.0" encoding="utf-8"?>
<odoo>

     <!-- Excel Report Download Wizard Form View-->
     <record id="view_product_excel_form_extended" model="ir.ui.view">
     <field name="name">product.excel.extended.form</field>
     <field name="model">product.excel.extended</field>
     <field name="arch" type="xml">
     <form string="Excel Report file">
         <group>
             <field name="excel_file" readonly="1" filename="file_name"/>
             <field name="file_name" invisible="1"/>
         </group>
         <footer>
             <button string="Cancel" class="oe_link oe_highlight" special="cancel"/>
        </footer>
         </form>
         </field>
    </record>

     <!-- Excel Report Download Wizard Action View-->
     <record id="action_product_excel_form" model="ir.actions.act_window">
         <field name="name">Reports Excel</field>
         <field name="view_id" ref="view_product_excel_form_extended"/>
         <field name="view_type">form</field>
         <field name="view_mode">form</field>
         <field name="res_model">product.excel.extended</field>
         <field name="target">new</field>
     </record>

</odoo>

CSV File :-
===========

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_excel_extended,access.product.excel.extended,model_product_excel_extended,,1,1,1,1


Hope it will helps for you.

Thanks,

1
Avatar
Vazgeç
Hoang Quan
Üretici

thank you. i added your code. But in view file excel not display. I can't download it :( how to download ?

Please help me. Thanks

Nikunj Dhameliya

This URL will download a file if it is generated for the record, you have to set filename and record id of product.excel.extended model

localhost:8069/web/content/?model=product.excel.extended&download=true&field=excel_file&id=Enter Recordid&filename=Enterexcelfilename

Avatar
Niyas Raphy (Walnut Software Solutions)
En İyi Yanıt

Hi,

If you are looking how to generate excel report in odoo, see this: How To Create Excel/XLS Report in Odoo

Thanks

1
Avatar
Vazgeç
Hoang Quan
Üretici

it's not for me. I need get xls for tree view. Can u help me ?

Avatar
Anusha
En İyi Yanıt

Hi,

   You can just refer the Odoo Apps store for any example modules. here is one .please check it and make necessary changes   XLSX REPORT SAMPLE     

0
Avatar
Vazgeç
Avatar
Hoang Quan
Üretici En İyi Yanıt

[img]https://i.imgur.com/1YFNIwd.png[/img]


Hello Jignesh Mehta
I added your code. But it's nothing. Help me pls. Thanks

0
Avatar
Vazgeç
Jignesh Mehta

Have you add access rights from csv file?

Hoang Quan
Üretici

yes i do?. All fields already exist in Database. U can see my image https://i.imgur.com/1YFNIwd.png

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

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Cant download excel data from v11 using chrome anymore Çözüldü
excel
Avatar
Avatar
1
Kas 22
3309
how to write an excel file into a field who is a field.Binary()?
excel
Avatar
0
Şub 17
4187
How to create execel report in openerp7
excel
Avatar
0
Mar 15
4739
How to use the module report_xls to generate XLS report in openerp ?
excel
Avatar
0
Mar 15
5963
I have hard time getting know of this platform
excel importing
Avatar
Avatar
Avatar
2
Eyl 23
2028
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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