From b0e5e6ffd46ca23824bcd14cdc5619f4e437622f Mon Sep 17 00:00:00 2001 From: husen daudi Date: Wed, 15 Apr 2009 10:26:13 +0530 Subject: [PATCH] Bugfix 361304 lp bug: https://launchpad.net/bugs/361304 fixed bzr revid: hda@hda-20090415045613-wfipffaak1xgrogo --- addons/report_account/report_receivable.py | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/addons/report_account/report_receivable.py b/addons/report_account/report_receivable.py index 61fb577a3f4..e7da923bd85 100644 --- a/addons/report_account/report_receivable.py +++ b/addons/report_account/report_receivable.py @@ -151,5 +151,57 @@ class report_aged_receivable(osv.osv): report_aged_receivable() +class report_invoice_created(osv.osv): + _name = "report.invoice.created" + _description = "Report of Invoices Created within Last 15 days" + _auto = False + _columns = { + 'name': fields.char('Description', size=64, readonly=True), + 'type': fields.selection([ + ('out_invoice','Customer Invoice'), + ('in_invoice','Supplier Invoice'), + ('out_refund','Customer Refund'), + ('in_refund','Supplier Refund'), + ],'Type', readonly=True), + 'number': fields.char('Invoice Number', size=32, readonly=True), + 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True), + 'amount_untaxed': fields.float('Untaxed', readonly=True), + 'amount_total': fields.float('Total', readonly=True), + 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), + 'date_invoice': fields.date('Date Invoiced', readonly=True), + 'date_due': fields.date('Due Date', readonly=True), + 'residual': fields.float('Residual', readonly=True), + 'state': fields.selection([ + ('draft','Draft'), + ('proforma','Pro-forma'), + ('proforma2','Pro-forma'), + ('open','Open'), + ('paid','Done'), + ('cancel','Cancelled') + ],'State', readonly=True), + 'origin': fields.char('Origin', size=64, readonly=True), + 'create_date' : fields.datetime('Create Date', readonly=True) + } + _order = 'create_date' + + def init(self, cr): + cr.execute("""create or replace view report_invoice_created as ( + select + inv.id as id, inv.name as name, inv.type as type, + inv.number as number, inv.partner_id as partner_id, + inv.amount_untaxed as amount_untaxed, + inv.amount_total as amount_total, inv.currency_id as currency_id, + inv.date_invoice as date_invoice, inv.date_due as date_due, + inv.residual as residual, inv.state as state, + inv.origin as origin, inv.create_date as create_date + from + account_invoice inv + where + (to_date(to_char(inv.create_date, 'YYYY-MM-dd'),'YYYY-MM-dd') <= CURRENT_DATE) + AND + (to_date(to_char(inv.create_date, 'YYYY-MM-dd'),'YYYY-MM-dd') > (CURRENT_DATE-15)) + )""") +report_invoice_created() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: