Skip to Content
Menu
This question has been flagged
1 Reply
8036 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 


Avatar
Discard
Best Answer

HI Ameer, 

You can check below apps which will export fields of data for any application into excel format 

https://apps.odoo.com/apps/modules/10.0/dev_export_excel/

Hope it Helps !

Thanks ,

Devintelle : Odoo Support Service Provider '

Mail: Devintelle@gmail.com

Avatar
Discard
Related Posts Replies Views Activity
2
Aug 17
7710
1
Aug 16
6540
1
Oct 15
2366
3
Sep 15
2821
3
Feb 24
11396