Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Artificial Intelligence
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Property Management
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to print an excel file from form view without using wizard

Odoberať

Get notified when there's activity on this post

This question has been flagged
openerpodoo10Odoo10.0
2 Replies
9512 Zobrazenia
Avatar
Vysakh B Thottarath

I need to print an excel file from form view without using wizard.The problem is that when press thegenerate_bt,the same form view appears like a box.
Code

from odoo import models, fields, api

from odoo.tools.translate import _

from odoo.exceptions import UserError, AccessError

from datetime import datetime, timedelta

import dateutil.parser

import base64

import xlwt

from cStringIO import StringIO

from pprint import pprint

import logging

from openerp import tools

_logger = logging.getLogger(__name__)

class SerialNumberXls(models.Model):

_inherit = 'stock.picking'

excel_file = fields.Binary(string='Download Report Excel',readonly="1")

file_name = fields.Char(string='Excel File',readonly="1")

def generate_bt(self):

print "hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"

print "hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"

print "hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"

print "hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"

workbook= xlwt.Workbook(encoding="UTF-8")

filename='MarkupReport.xls'

sheet= workbook.add_sheet('Markup Report',cell_overwrite_ok=True)

style = xlwt.easyxf('font:name Arial,height 200;')

style2 = xlwt.easyxf('font:name Arial,height 200,bold True;align: horiz center, vert center;')

style_filter = xlwt.easyxf('font:name Arial; align: horiz center, vert center;')

style_normal_left = xlwt.easyxf('font:name Arial; align: horiz left, vert center;')

style_normal_right = xlwt.easyxf('font:name Arial; align: horiz right, vert center;')

row =0

col = 5

sheet.write(row,col,"hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii",style2)

return {

'view_type': 'form',

"view_mode": 'form',

'res_model': 'stock.picking',

'res_id': self.id,

'type': 'ir.actions.act_window',

                  'target': 'new'

}

0
Avatar
Zrušiť
Avatar
Emipro Technologies Pvt. Ltd.
Best Answer

You have return stock piking action that's why it is showing you same record.

You should return action as following :

return

{

    'type' : 'ir.actions.act_url','url': 

    'web/content/?model=stock.picking&field=excel_file&download=true&id=%s&filename=excel_file.xls'%(self.id),

    'target': 'new',

}


1
Avatar
Zrušiť
Avatar
Sushma
Best Answer

Hi,

hope this link helps: https://stackoverflow.com/questions/37651058/how-can-i-generate-xls-report-in-odoo

1
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Upgrading to openerp to odoo Solved
openerp odoo10
Avatar
Avatar
1
jan 19
4057
could not execute command lessc in odoo 10 Windows Solved
odoo10 Odoo10.0
Avatar
Avatar
Avatar
3
mar 18
17064
leave management odoo 10
odoo10 Odoo10.0
Avatar
Avatar
1
sep 17
4324
Odoo10: how to replace inherited qweb template content ?
odoo10 Odoo10.0 Odoo10
Avatar
Avatar
Avatar
3
jan 18
22071
Visibility of field only when particular field selected.
xml python2.7 openerp odoo10
Avatar
Avatar
2
júl 22
9920
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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