[ADD] idea, lunch : lunch order analysis and vote reports added
bzr revid: vir@tinyerp.com-20100622122604-7t4i0d2durfqz8n1
This commit is contained in:
+1
-1
@@ -304,7 +304,7 @@ class idea_vote(osv.osv):
|
||||
_rec_name = 'score'
|
||||
|
||||
_columns = {
|
||||
'user_id': fields.many2one('res.users', 'By user', readonly="True"),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly="True"),
|
||||
'idea_id': fields.many2one('idea.idea', 'Idea', readonly="True", ondelete='cascade'),
|
||||
'score': fields.selection(VoteValues, 'Vote Status', readonly="True"),
|
||||
'date': fields.datetime('Date', readonly="True"),
|
||||
|
||||
@@ -149,8 +149,22 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Ideas vote">
|
||||
<group col="10" colspan="4">
|
||||
<filter icon="terp-go-year" string=" 365 Days "
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Tasks performed in last 365 days"/>
|
||||
<filter icon="terp-go-month" string=" 30 Days "
|
||||
name="month"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Tasks performed in last 30 days"/>
|
||||
<filter icon="terp-go-week"
|
||||
string=" 7 Days "
|
||||
name="week"
|
||||
separator="1"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Tasks during last 7 days"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="idea_id" widget="selection"/>
|
||||
<field name="user_id"/>
|
||||
<field name="user_id" string="User"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="14">
|
||||
@@ -371,6 +385,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_idea_vote_search"/>
|
||||
<field name="context">{'search_default_week':1}</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Votes" parent="menu_idea_reporting" id="menu_idea_vote" action="action_idea_vote"/>
|
||||
|
||||
@@ -45,12 +45,13 @@
|
||||
'wizard/lunch_cashbox_clean_view.xml',
|
||||
'lunch_view.xml',
|
||||
'lunch_report.xml',
|
||||
'report/report_lunch_order_view.xml',
|
||||
#'process/lunch_process.xml'
|
||||
],
|
||||
"demo_xml": ['lunch_demo.xml',
|
||||
],
|
||||
"test": ['test/test_lunch.yml'
|
||||
],
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,10 +15,11 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import order
|
||||
import report_lunch_order
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import tools
|
||||
from osv import fields,osv
|
||||
|
||||
class report_lunch_order(osv.osv):
|
||||
_name = "report.lunch.order"
|
||||
_description = "Lunch Orders Statistics"
|
||||
_auto = False
|
||||
_rec_name = 'date'
|
||||
_columns = {
|
||||
'date': fields.date('Date Order', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'User Name'),
|
||||
'box_name': fields.char('Name', size=30),
|
||||
'price_total':fields.float('Total Price', readonly=True),
|
||||
}
|
||||
_order = 'date desc'
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_lunch_order')
|
||||
cr.execute("""
|
||||
create or replace view report_lunch_order as (
|
||||
select
|
||||
min(lo.id) as id,
|
||||
lo.date as date,
|
||||
to_char(lo.date, 'YYYY') as year,
|
||||
to_char(lo.date, 'MM') as month,
|
||||
to_char(lo.date, 'YYYY-MM-DD') as day,
|
||||
lo.user_id,
|
||||
cm.name as box_name,
|
||||
sum(lp.price) as price_total
|
||||
|
||||
from
|
||||
lunch_order as lo
|
||||
left join lunch_cashmove as cm on (cm.id = lo.cashmove)
|
||||
left join lunch_cashbox as lc on (lc.id = cm.box)
|
||||
left join lunch_product as lp on (lo.product = lp.id)
|
||||
|
||||
group by
|
||||
lo.date,lo.user_id,cm.name
|
||||
)
|
||||
""")
|
||||
report_lunch_order()
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_report_lunch_order_tree" model="ir.ui.view">
|
||||
<field name="name">report.lunch.order.tree</field>
|
||||
<field name="model">report.lunch.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Sales Analysis">
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="user_id" />
|
||||
<field name="box_name"/>
|
||||
<field name="price_total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_lunch_order_search" model="ir.ui.view">
|
||||
<field name="name">report.lunch.order.search</field>
|
||||
<field name="model">report.lunch.order</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Lunch Order Analysis">
|
||||
<group>
|
||||
<filter icon="terp-go-year" string=" 365 Days "
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Tasks performed in last 365 days"/>
|
||||
<filter icon="terp-go-month" string=" 30 Days "
|
||||
name="month"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Tasks performed in last 30 days"/>
|
||||
<filter icon="terp-go-week"
|
||||
string=" 7 Days "
|
||||
separator="1"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Tasks during last 7 days"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="10" col="12">
|
||||
<filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Box" icon="terp-accessories-archiver+" context="{'group_by':'box_name'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_report_lunch_order_all" model="ir.actions.act_window">
|
||||
<field name="name">Lunch Order Analysis</field>
|
||||
<field name="res_model">report.lunch.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="search_view_id" ref="view_report_lunch_order_search"/>
|
||||
<field name="context">{'search_default_month':1,'search_default_User':1}</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Lunch Order Analysis" parent="menu_lunch_reporting_order"
|
||||
id="menu_lunch_order_analysis" action="action_report_lunch_order_all" sequence="1" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user