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 |