Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Print out Excel file format for report.

By
ameer ashraf
on 12/16/15, 5:26 AM 605 views

Hello, Good day all,

I am generating a module to print out POS Details Of Sales report in Excel file format. I already inherit the "point_of_sale.view_pos_details", the wizard, to add "EXCEL" button beside "Print Report" button. right now i stuck on how to create one .py file containing the parser and code to generate the excel report. 

this is my .xml file

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

<openerp>

<data>

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

<field name="inherit_id" ref="point_of_sale.view_pos_details"/>

<field name="name">POS Details Inherit</field>

<field name="model">pos.details</field>

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

<button string="Print Report" position="replace">

<button

icon="gtk-print"

name="print_report"

string="Print"

type="object"

class="oe_highlight"/>

or

<button

icon="gtk-execute"

name="print_excel"

string="Export"

type="object"

class="oe_highlight"

context="{'xls_export':1}"/>

or

</button>

</field>

</record>

</data>

</openerp>

this is my .py file (unfinished)


import time

from openerp.osv import orm, fields

from openerp.osv import orm

from openerp.tools.translate import _

from openerp.addons.point_of_sale.wizard.pos_details import pos_details

from openerp.addons.export_excel import export_excel

import logging

_logger = logging.getLogger(__name__)

class export_excel(orm.TransientModel):

_inherit = 'pos.details'

_description = 'Print out Excel format file'

_columns = {

'date_start': fields.date('Date Start', required=True),

'date_end': fields.date('Date End', required=True),

'user_ids': fields.many2many('res.users', 'pos_details_report_user_rel', 'user_id', 'wizard_id', 'Salespeople'),

}

_defaults = {

'date_start': fields.date.context_today,

'date_end': fields.date.context_today,

}

def fields_view_get(self, cr, uid, view_id=None, view_type='form',

context=None, toolbar=False, submenu=False):

return super(pos_details, self).\

fields_view_get(cr, uid, view_id, view_type, context, toolbar,

submenu)

def print_excel(self, cr, uid, ids, context=None):

return 


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 12/16/15, 5:26 AM
Seen: 605 times
Last updated: 12/16/15, 6:17 AM