Added turnover Per month report for board_service

bzr revid: jvo@tinyerp.com-20090312145420-l6k2qst6miqh9c8q
This commit is contained in:
Jay (Open ERP)
2009-03-12 20:24:20 +05:30
parent 07f30e8310
commit 3cb79589ae
3 changed files with 91 additions and 0 deletions
+21
View File
@@ -110,5 +110,26 @@ class report_sale_order_category(osv.osv):
""")
report_sale_order_category()
class report_turnover_per_month(osv.osv):
_name = "report.turnover.per.month"
_description = "Turnover Per Month"
_auto = False
_columns = {
'name': fields.date('Month', readonly=True),
'turnover': fields.float('Total Turnover', readonly=True),
}
def init(self, cr):
cr.execute("""
create or replace view report_turnover_per_month as (
select min(am.id) as id, sum(credit) as turnover,to_char(am.date, 'YYYY-MM-01') as name from account_move_line am
where am.account_id in (select distinct(account_id) from account_invoice_line)
and
am.move_id in(select distinct(aw.move_id) from account_invoice aw,account_invoice_line l where l.invoice_id=aw.id)
group by to_char(am.date, 'YYYY-MM-01')
)
""")
report_turnover_per_month()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+32
View File
@@ -171,6 +171,38 @@
<field name="domain">[('state','&lt;&gt;','done')]</field>
</record>
<record model="ir.ui.view" id="view_turnover_month_tree">
<field name="name">report.turnover.per.month.tree</field>
<field name="model">report.turnover.per.month</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Turnover Per Month">
<field name="name" select="1"/>
<field name="turnover" select="2"/>
</tree>
</field>
</record>
<record id="view_turnover_month_graph" model="ir.ui.view">
<field name="name">report.turnover.per.month.graph</field>
<field name="model">report.turnover.per.month</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Turnover Per Month" type="bar">
<field name="name" />
<field name="turnover" />
</graph>
</field>
</record>
<record model="ir.actions.act_window" id="action_turnover_month_tree">
<field name="type">ir.actions.act_window</field>
<field name="name">Turnover Per Month</field>
<field name="res_model">report.turnover.per.month</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_turnover_month_tree"/>
</record>
</data>
</openerp>
+38
View File
@@ -59,6 +59,44 @@ class report_task_user_pipeline_open (osv.osv):
report_task_user_pipeline_open()
#class report_timesheet_task(osv.osv):
# _name = "report.timesheet.task"
# _description = "Report on Timesheets and Tasks per User Per Month"
# _auto = False
#
# def get_hrs_timesheet(self, cr, uid, ids, name,args,context):
# result = {}
#
# for record in self.browse(cr, uid, ids, context):
# last_date = mx.DateTime.strptime(record.month, '%Y-%m-%d') + mx.DateTime.RelativeDateTime(months=1) - 1
# obj=self.pool.get('hr_timesheet_sheet.sheet')
# sheet_ids = obj.search(cr,uid,[('user_id','=',record.user_id.id),('date_current','>=',record.month),('date_current','<=',last_date.strftime('%Y-%m-%d'))])
# data_days = obj.read(cr,uid,sheet_ids,['total_attendance_day','date_current','user_id'])
# total = 0.0
# for day_attendance in data_days:
# total += day_attendance['total_attendance_day']
# result[record.id] = total
#
# return result
#
# _columns = {
# 'month': fields.date('Month', required=True,readonly=True),
# 'user_id': fields.many2one('res.users', 'User' ,readonly=True, required=True),
# 'timesheet_hrs': fields.function(get_hrs_timesheet,method=True, string="Timesheet Hrs" ),
# 'task_hrs': fields.float('Task Hrs', readonly=True, required=True),
# }
#
#
# def init(self, cr):
# cr.execute("""create or replace view report_timesheet_task as (
# select min(p.id) as id, to_char(p.date, 'YYYY-MM-01') as month, min(r.id) as user_id, sum(p.hours) as task_hrs,0.0 as timesheet_hrs
# from project_task_work p,res_users r
# where (r.id=p.user_id)
# group by to_char(p.date, 'YYYY-MM-01'))""")
#
#
#
#report_timesheet_task()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: