Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

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

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

XLS report in odoo saas 6.

Subscribe

Get notified when there's activity on this post

This question has been flagged
saasreportxlsodoo
4719 Views
Avatar
ameer ashraf

I am trying to use the addons "report_xls" module to export the Details of
Sales report to Excel.

Beside that, i also have try to refer from the "web_prinscreen_ZB" module to export those report into Excel file format.

The main problem is i have no idea of how with this. I tried to go through the
suggested module such as "account_journal_report_xls" and
"account_move_line_report_xls". i read their code, even is difficult for me to
understand, i tried to rewrite another module based on this suggested module.
however, none of my effort could solve the issues.

i also tried to search for help from Google, yet still all the answer provided
either i do not understand or cannot solve the problem.

this error always appear?

global name 'pooler' is not defined
<type 'exceptions.NameError'>,global name 'pooler' is not defined,<traceback object at 0x7f1e88393cb0>

p/s : i have edit this question


.py file :

import xlwt

from datetime import datetime

from openerp import pooler

from openerp.osv import orm

from openerp.osv import osv

from openerp.addons.report_xls.report_xls import report_xls

from openerp.addons.report_xls.utils import rowcol_to_cell, _render

#from openerp.addons.point_of_sale import pos_details

from openerp.tools.translate import _

from openerp.report import report_sxw

import logging

_logger = logging.getLogger(__name__)

class export_excel_xls_parser(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):

super(export_excel_xls_parser, self).__init__(cr, uid, name,

context=None)

self.context = context

wanted_list = excel_obj._report_xls_fields(cr, uid, context)

template_changes = excel_obj._report_xls_template(cr, uid, context)

self.localcontext.update({

'datetime': datetime,

'wanted_list': wanted_list,

'template_changes': template_changes,

})

class export_excel_xls(report_xls):

def __init__(self, name, table, rml=False, parser=False, header=True,

store=False):

super(export_excel_xls, self).__init__(

name, table, rml, parser, header, store)

# Cell Styles

_xs = self.xls_styles

# header

rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']

self.rh_cell_style = xlwt.easyxf(rh_cell_format)

self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])

self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

# lines

aml_cell_format = _xs['borders_all']

self.aml_cell_style = xlwt.easyxf(aml_cell_format)

self.aml_cell_style_center = xlwt.easyxf(

aml_cell_format + _xs['center'])

self.aml_cell_style_date = xlwt.easyxf(

aml_cell_format + _xs['left'],

num_format_str=report_xls.date_format)

self.aml_cell_style_decimal = xlwt.easyxf(

aml_cell_format + _xs['right'],

num_format_str=report_xls.decimal_format)

# totals

rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']

self.rt_cell_style = xlwt.easyxf(rt_cell_format)

self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])

self.rt_cell_style_decimal = xlwt.easyxf(

rt_cell_format + _xs['right'],

num_format_str=report_xls.decimal_format)

def _excel_title(self, o, ws, _p, row_pos, _xs):

cell_style = xlwt.easyxf(_xs['xls_title'])

report_name = (10 * ' ').join([

_p.company.name,

_p.title(o)[0],

_p.title(o)[1],

_p._("excel Overview") + ' - ' + _p.company.currency_id.name,

])

c_specs = [

('report_name', 1, 0, 'text', report_name),

]

row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])

row_pos = self.xls_write_row(

ws, row_pos, row_data, row_style=cell_style)

return row_pos + 1

def _excel_lines(self, o, ws, _p, row_pos, _xs):

wanted_list = self.wanted_list

debit_pos = self.debit_pos

credit_pos = self.credit_pos

# Column headers

c_specs = map(lambda x: self.render(

x, self.col_specs_lines_template, 'header',

render_space={'_': _p._}), wanted_list)

row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])

row_pos = self.xls_write_row(

ws, row_pos, row_data, row_style=self.rh_cell_style,

set_column_size=True)

ws.set_horz_split_pos(row_pos)

# export move lines

aml_start_pos = row_pos

aml_cnt = len(_p.lines(o))

cnt = 0

for l in _p.lines(o):

cnt += 1

debit_cell = rowcol_to_cell(row_pos, debit_pos)

credit_cell = rowcol_to_cell(row_pos, credit_pos)

bal_formula = debit_cell + '-' + credit_cell

_logger.debug('dummy call - %s', bal_formula)

c_specs = map(

lambda x: self.render(x, self.col_specs_lines_template,

'lines'), wanted_list)

row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])

row_pos = self.xls_write_row(

ws, row_pos, row_data, row_style=self.aml_cell_style)

if l['draw_line'] and cnt != aml_cnt:

row_pos += 1

def _excel_vat_summary(self, o, ws, _p, row_pos, _xs):

if not _p.tax_codes(o):

return row_pos

title_cell_style = xlwt.easyxf(_xs['bold'])

c_specs = [('summary_title', 1, 0, 'text', _p._("VAT Declaration"))]

row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])

row_pos = self.xls_write_row(

ws, row_pos, row_data, row_style=title_cell_style) + 1

wanted_list = self.wanted_list

vat_summary_wanted_list = ['tax_case_name', 'tax_code', 'tax_amount']

# calculate col_span

cols_number = len(wanted_list)

vat_summary_cols_number = len(vat_summary_wanted_list)

if vat_summary_cols_number > cols_number:

raise orm.except_orm(

_('Programming Error!'),

_("vat_summary_cols_number should be < cols_number !"))

index = 0

for i in range(vat_summary_cols_number):

col = vat_summary_wanted_list[i]

col_size = self.col_specs_lines_template[

wanted_list[index]]['header'][1]

templ_col_size = self.col_specs_vat_summary_template[

col]['header'][1]

# _logger.warn("col=%s, col_size=%s, templ_col_size=%s",

# col, col_size, templ_col_size)

col_span = 1

if templ_col_size > col_size:

new_size = col_size

while templ_col_size > new_size:

col_span += 1

index += 1

new_size += self.col_specs_lines_template[

wanted_list[index]]['header'][1]

self.col_specs_vat_summary_template[col]['header'][0] = col_span

self.col_specs_vat_summary_template[

col]['tax_totals'][0] = col_span

index += 1

c_specs = map(lambda x: self.render(

x, self.col_specs_vat_summary_template, 'header'),

vat_summary_wanted_list)

row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])

row_pos = self.xls_write_row(

ws, row_pos, row_data, row_style=self.rh_cell_style)

for t in _p.tax_codes(o):

c_specs = map(lambda x: self.render(

x, self.col_specs_vat_summary_template, 'tax_totals'),

vat_summary_wanted_list)

row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])

row_pos = self.xls_write_row(

ws, row_pos, row_data, row_style=self.aml_cell_style)

return row_pos

def generate_xls_report(self, _p, _xs, data, objects, wb):

wanted_list = _p.wanted_list

if _p.display_currency:

wanted_list += ['amount_currency', 'currency_name']

self.wanted_list = wanted_list

self.col_specs_lines_template.update(_p.template_changes)

self.debit_pos = 'debit' in wanted_list and wanted_list.index('debit')

self.credit_pos = 'credit' in wanted_list and wanted_list.index(

'credit')

if not (self.credit_pos and self.debit_pos) and 'balance' \

in wanted_list:

raise orm.except_orm(_('Customisation Error!'),

_("The 'Balance' field is a calculated XLS \

field requiring the presence of the \

'Debit' and 'Credit' fields !"))

for o in objects:

sheet_name = ' - '.join([o[1].code, o[0].code]

)[:31].replace('/', '-')

sheet_name = sheet_name[:31].replace('/', '-')

ws = wb.add_sheet(sheet_name)

ws.panes_frozen = True

ws.remove_splits = True

ws.portrait = 0 # Landscape

ws.fit_width_to_pages = 1

row_pos = 0

# set print header/footer

ws.header_str = self.xls_headers['standard']

ws.footer_str = self.xls_footers['standard']

# Data

row_pos = self._excel_title(o, ws, _p, row_pos, _xs)

row_pos = self._excel_lines(o, ws, _p, row_pos, _xs)

row_pos = self._excel_vat_summary(o, ws, _p, row_pos, _xs)

export_excel_xls('report.export.excel.xls', 'export.excel.period',

parser=export_excel_xls_parser)

0
Avatar
Discard
Ermin Trevisan

Without specifying your issues your chances for help are minimal.

ameer ashraf
Author

@Ermin Trevisan i have eidit and update the question...

Axel Mendoza

remove the "from openerp import pooler" statement and try again

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

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

Sign up
Related Posts Replies Views Activity
How can I create and save a report in the attachments?
report odoo
Avatar
0
सित॰ 24
2435
Odoo Report - getting currently singular active ID
report odoo
Avatar
0
मार्च 18
4268
How to get pdf file while printing report in odoo 10?
report odoo
Avatar
0
जुल॰ 17
8809
Problem of printing odoo reports in a VPS Solved
report odoo
Avatar
1
नव॰ 16
3811
How to make a button print with two choices in odoo
report odoo
Avatar
Avatar
1
जन॰ 16
5057
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة 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, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

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