[MERGE] dashboard

bzr revid: hmo@tinyerp.com-20100202064545-yihzfjkl95rwuo8d
This commit is contained in:
Harry (Open ERP)
2010-02-02 12:15:45 +05:30
19 changed files with 564 additions and 66 deletions
+24
View File
@@ -0,0 +1,24 @@
# -*- 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/>.
#
##############################################################################
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+42
View File
@@ -0,0 +1,42 @@
# -*- 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/>.
#
##############################################################################
{
'name': 'Board for Human Reasources Management',
'version': '1.0',
'category': '',
'description': """
This module implements a dashboard for human resource management that includes:
* My Current Timesheet
* My Leaves
* My Expenses
""",
'author': 'Tiny',
'depends': [ 'crm_project','board','hr_expense','hr_timesheet_sheet','hr_holidays'
],
'update_xml': ['board_hr_view.xml'],
'demo_xml': [],
'installable': True,
'active': False,
'certificate': '',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+72
View File
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
<menuitem
id="menu_hr_deshboard"
name="Human Resources"
parent="base.dashboard"/>
<record id="action_my_expense" model="ir.actions.act_window">
<field name="name">My Expenses</field>
<field name="res_model">hr.expense.expense</field>
<field name="view_type">form</field>
<field name="domain">[('state','=','draft'),('user_id','=',uid)]</field>
<field name="view_id" ref="hr_expense.view_editable_expenses_tree"/>
</record>
<record id="act_hr_current_timesheet_sheet_form" model="ir.actions.act_window">
<field name="name">Timesheets</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr_timesheet_sheet.sheet</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="domain">[('date_to','&gt;=',time.strftime('%Y-%m-01')),('date_from','&lt;=',time.strftime('%Y-%m-01'))]</field>
<field name="search_view_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_tree"/>
</record>
<record id="action_view_holiday_status_board" model="ir.actions.act_window">
<field name="name">My Leaves</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.holidays.per.user</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="hr_holidays.view_my_leave_board_tree"/>
</record>
<record id="board_hr_form" model="ir.ui.view">
<field name="name">board.hr.form</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="My Board">
<hpaned>
<child1>
<action colspan="4" height="220" name="%(act_hr_current_timesheet_sheet_form)d" string="My current timesheet" width="510"/>
</child1>
<child2>
<action colspan="4" height="220" name="%(action_view_holiday_status_board)d" string="My Leaves"/>
<action colspan="4" height="220" name="%(action_my_expense)d" string="My Expenses" />
</child2>
</hpaned>
</form>
</field>
</record>
<record id="open_board_hr" model="ir.actions.act_window">
<field name="name">Human Resources Dashboard</field>
<field name="res_model">board.board</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="usage">menu</field>
<field name="view_id" ref="board_hr_form"/>
</record>
<menuitem
action="open_board_hr"
icon="terp-graph"
id="menu_hr_project"
parent="menu_hr_deshboard"
sequence="4"/>
</data>
</openerp>
+6 -5
View File
@@ -27,10 +27,9 @@
'description': """ 'description': """
This module implements a dashboard for project member that includes: This module implements a dashboard for project member that includes:
* List of my open tasks * List of my open tasks
* List of my next deadlines * List of messages
* List of public notes * Members list of project
* Graph of my timesheet * Issues
* Graph of my work analysis
""", """,
'author': 'Tiny', 'author': 'Tiny',
'depends': [ 'depends': [
@@ -40,7 +39,9 @@ This module implements a dashboard for project member that includes:
'report_analytic_planning', 'report_analytic_planning',
'report_analytic_line', 'report_analytic_line',
'report_task', 'report_task',
'hr_timesheet_sheet' 'hr_timesheet_sheet',
'crm_project',
'resource'
], ],
'update_xml': ['board_project_view.xml', 'board_project_manager_view.xml'], 'update_xml': ['board_project_view.xml', 'board_project_manager_view.xml'],
'demo_xml': ['board_project_demo.xml'], 'demo_xml': ['board_project_demo.xml'],
@@ -53,7 +53,7 @@
<form string="Project manager board"> <form string="Project manager board">
<hpaned> <hpaned>
<child1> <child1>
<action colspan="4" height="220" name="%(act_my_project)d" string="My projects" width="510"/> <!-- <action colspan="4" height="220" name="%(act_my_project)d" string="My projects" width="510"/>-->
<action colspan="4" height="150" name="%(act_my_account)d" string="My accounts to invoice"/> <action colspan="4" height="150" name="%(act_my_account)d" string="My accounts to invoice"/>
@@ -61,7 +61,7 @@
</child1> </child1>
<child2> <child2>
<button colspan="4" icon="terp-partner" name="%(open_board_project)d" string="My tasks board" type="action"/> <button colspan="4" icon="terp-partner" name="%(open_board_project)d" string="My tasks board" type="action"/>
<action colspan="4" name="%(report_analytic_planning.action_account_analytic_planning_stat_form)d" string="My Project's planning" domain="[('manager_id','=',uid),('planning_id.state','&lt;&gt;','cancel')]"/> <action colspan="4" name="%(report_analytic_planning.action_account_analytic_planning_stat_form)d" string="My Project's planning" domain="[('manager_id','=',uid),('planning_id.state','&lt;&gt;','cancel')]"/>
+40 -5
View File
@@ -22,6 +22,23 @@
</tree> </tree>
</field> </field>
</record> </record>
<!-- Editable My task -->
<record id="view_task_tree" model="ir.ui.view">
<field name="name">project.task.tree</field>
<field name="model">project.task</field>
<field name="type">tree</field>
<field eval="99" name="priority"/>
<field name="arch" type="xml">
<tree editable="top" colors="red:date_deadline&lt;current_date;blue:date_deadline==current_date;black:date_deadline&gt;current_date" string="My Tasks">
<field name="name"/>
<field name="project_id"/>
<field name="date_deadline"/>
<field name="planned_hours"/>
<field name="effective_hours"/>
<field name="priority"/>
</tree>
</field>
</record>
<record id="action_view_task_tree" model="ir.actions.act_window"> <record id="action_view_task_tree" model="ir.actions.act_window">
<field name="name">My Open Tasks</field> <field name="name">My Open Tasks</field>
<field name="res_model">project.task</field> <field name="res_model">project.task</field>
@@ -47,6 +64,25 @@
<field name="domain">[('type','=','Project')]</field> <field name="domain">[('type','=','Project')]</field>
</record> </record>
<!--Actions for deshboard -->
<record id="action_view_project_editable_messages_tree" model="ir.actions.act_window">
<field name="name">Messages</field>
<field name="res_model">project.message</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="project.view_project_editable_message_tree"/>
</record>
<record id="action_view_project_member_tree" model="ir.actions.act_window">
<field name="name">Project's Members</field>
<field name="res_model">resource.resource</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('resource_type','=','user')]</field>
<field name="view_id" ref="resource.view_project_member_tree"/>
</record>
<record id="board_project_form" model="ir.ui.view"> <record id="board_project_form" model="ir.ui.view">
<field name="name">board.project.form</field> <field name="name">board.project.form</field>
<field name="model">board.board</field> <field name="model">board.board</field>
@@ -56,12 +92,11 @@
<hpaned> <hpaned>
<child1> <child1>
<action colspan="4" height="220" name="%(action_view_task_tree)d" string="My Open Tasks" width="510"/> <action colspan="4" height="220" name="%(action_view_task_tree)d" string="My Open Tasks" width="510"/>
<action colspan="4" height="150" name="%(action_view_task_tree_deadline)d" string="My Deadlines"/> <action colspan="4" height="150" name="%(action_view_project_member_tree)d" string="Members list of project"/>
<action colspan="4" height="150" name="%(action_view_board_note_tree)d" string="Public Notes"/> </child1>
</child1>
<child2> <child2>
<action colspan="4" name="%(report_analytic_planning.action_account_analytic_planning_stat_form)d" string="My Planning" domain="[('user_id','=',uid),('planning_id.state','&lt;&gt;','cancel')]"/> <action colspan="4" name="%(action_view_project_editable_messages_tree)d" string="Messages"/>
<action colspan="4" name="%(report_timesheet.action_timesheet_user_stat_all)d" string="Timesheets"/> <action colspan="4" name="%(crm_project.crm_case_categ_act0)d" string="Issues"/>
</child2> </child2>
</hpaned> </hpaned>
</form> </form>
+25 -4
View File
@@ -5,6 +5,24 @@
<field name="name">Sales</field> <field name="name">Sales</field>
</record> </record>
<record model="ir.actions.act_window" id="board_crm_case_categ_phone_incoming0">
<field name="res_model">crm.phonecall</field>
<field name="view_type">form</field>
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm.crm_case_phone_tree_view"/>
<field name="domain">[('user_id','=',uid)]</field>
<field name="context" eval="{'default_state':'open'}"/>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
</record>
<record model="ir.actions.act_window" id="board_crm_case_categ_meet">
<field name="res_model">crm.meeting</field>
<field name="view_mode">tree,form,gantt</field>
<field name="view_id" ref="crm.crm_case_tree_view_meet"/>
<field name="domain">[('user_id','=',uid)]</field>
<field name="domain">[('date','&gt;=',time.strftime('%Y-%m-%d')),('date','&lt;=',(datetime.datetime.today() + datetime.timedelta(days=2)).strftime('%Y-%m-%d'))]</field>
<field name="context" eval="{'default_state':'open'}"/>
</record>
<record id="board_sales_manager_form" model="ir.ui.view"> <record id="board_sales_manager_form" model="ir.ui.view">
<field name="name">board.sales.manager.form</field> <field name="name">board.sales.manager.form</field>
<field name="model">board.board</field> <field name="model">board.board</field>
@@ -14,13 +32,16 @@
<hpaned position="100"> <hpaned position="100">
<child1> <child1>
<action colspan="4" height="200" name="%(sale.action_order_tree5)d" string="My quotations" width="510" domain="[('state','=','draft'),('user_id','=',uid)]"/> <action colspan="4" height="200" name="%(sale.action_order_tree5)d" string="My quotations" width="510" domain="[('state','=','draft'),('user_id','=',uid)]"/>
<action colspan="4" name="%(report_sale.action_order_sale_list)d" string="Top ten sales of the month"/> <action colspan="4" name="%(board_crm_case_categ_phone_incoming0)d" string="My planned calling calls (IN / OUT)" width="510"/>
<action colspan="4" name="%(report_crm.action_report_crm_case_user_tree)d" string="Cases statistics"/> <!-- <action colspan="4" name="%(report_sale.action_order_sale_list)d" string="Top ten sales of the month"/>-->
<!-- <action colspan="4" name="%(report_crm.action_report_crm_case_user_tree)d" string="Cases statistics"/>-->
</child1> </child1>
<child2> <child2>
<action colspan="4" name="%(report_sale.action_order_category_tree_all)d" string="Average Sales by Category of Products(this month)" view_mode="graph,tree"/> <action colspan="4" name="%(crm.crm_case_category_act_oppor11)d" string="My Opportunities" width="510" domain="[('user_id','=',uid)]"/>
<action colspan="4" name="%(report_crm.action_report_crm_case_user_tree)d" string="Cases of the month" view_mode="graph,tree"/> <action colspan="4" name="%(board_crm_case_categ_meet)d" String="My Meetings" domain="[('state','=','open')]" width="510"/>
<!-- <action colspan="4" name="%(report_sale.action_order_category_tree_all)d" string="Average Sales by Category of Products(this month)" view_mode="graph,tree"/>-->
<!-- <action colspan="4" name="%(report_crm.action_report_crm_case_user_tree)d" string="Cases of the month" view_mode="graph,tree"/>-->
</child2> </child2>
</hpaned> </hpaned>
</form> </form>
+24
View File
@@ -0,0 +1,24 @@
# -*- 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/>.
#
##############################################################################
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+42
View File
@@ -0,0 +1,42 @@
# -*- 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/>.
#
##############################################################################
{
'name': 'Dashboard for Warehouse',
'version': '1.0',
'category': 'Board/Warehouse',
'description': """
This module implements a dashboard for warehouse that includes:
* Products to receive in delay (date < = today)
* Procurement in exception
* Graph : Number of Receive products vs planned (bar graph on week par day)
* Graph : Number of Delivery products vs planned (bar graph on week par day)
""",
'author': 'Tiny',
'depends': ['board','mrp','stock' ],
'update_xml': ['board_warehouse_view.xml'],
'demo_xml': [],
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="note_warehouse_type" model="board.note.type">
<field name="name">Warehouse</field>
</record>
<record id="board_warehouse_form" model="ir.ui.view">
<field name="name">board.warehouse.form</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Warehouse board">
<hpaned position="100">
<child1>
<action colspan="4" name="%(mrp.mrp_procurement_action5)d" string="Procurement Exceptions" width="510" />
<action colspan="4" name="%(stock.action_reception_picking_move)d" string="Products To Receive" />
</child1>
<child2>
<action colspan="4" name="%(stock.action_move_graph_reception_picking)d" string="Products To Receive" width="510"/>
<action colspan="4" name="%(stock.action_move_delivery_products_planned)d" string="Delivery Products Vs Planned" width="510"/>
</child2>
</hpaned>
</form>
</field>
</record>
<record id="open_board_warehouse" model="ir.actions.act_window">
<field name="name">Warehouse Dashboard</field>
<field name="res_model">board.board</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="board_warehouse_form"/>
</record>
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
<menuitem id="menu_board_warehouse_main" name="Warehouse" parent="base.dashboard"/>
<menuitem action="open_board_warehouse" icon="terp-graph" id="menu_board_warehouse" parent="menu_board_warehouse_main" sequence="1"/>
</data>
</openerp>
+15
View File
@@ -37,6 +37,21 @@
</field> </field>
</record> </record>
<record id="view_editable_expenses_tree" model="ir.ui.view">
<field name="name">hr.expense.expense.tree</field>
<field name="model">hr.expense.expense</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Expenses" editable="top">
<field name="date"/>
<field name="employee_id"/>
<field name="name"/>
<field name="ref"/>
<field name="amount"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="view_expenses_form" model="ir.ui.view"> <record id="view_expenses_form" model="ir.ui.view">
<field name="name">hr.expense.form</field> <field name="name">hr.expense.form</field>
+14 -1
View File
@@ -148,7 +148,20 @@
</field> </field>
</record> </record>
<!-- My leave dashboard -->
<record model="ir.ui.view" id="view_my_leave_board_tree">
<field name="name">hr.holidays.per.user.form</field>
<field name="model">hr.holidays.per.user</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="My Leaves" editable="top">
<field name="holiday_status"/>
<field name="max_leaves"/>
<field name="leaves_taken" />
<field name="remaining_leaves"/>
</tree>
</field>
</record>
<!-- <menuitem <!-- <menuitem
name="Holidays Management" name="Holidays Management"
@@ -19,6 +19,25 @@
</field> </field>
</record> </record>
<!-- Editable current timesheet used in dashboard-->
<record id="hr_timesheet_sheet_tree" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.tree</field>
<field name="model">hr_timesheet_sheet.sheet</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Timesheets" editable="top">
<field name="user_id"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="name"/>
<field name="total_attendance" groups="hr_attendance.group_hr_attendance"/>
<field name="total_timesheet"/>
<field name="total_difference" groups="hr_attendance.group_hr_attendance"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="hr_timesheet_account_form" model="ir.ui.view"> <record id="hr_timesheet_account_form" model="ir.ui.view">
<field name="name">hr.timesheet.account.form</field> <field name="name">hr.timesheet.account.form</field>
<field name="model">hr_timesheet_sheet.sheet.account</field> <field name="model">hr_timesheet_sheet.sheet.account</field>
+15
View File
@@ -685,5 +685,20 @@
<act_window domain="[('user_id', '=', active_id),('date', '&gt;=', time.strftime('%Y-%m-01'))]" id="act_res_users_2_project_task_work_month" name="Month works" res_model="project.task.work" src_model="res.users" view_mode="tree,form" view_type="form"/> <act_window domain="[('user_id', '=', active_id),('date', '&gt;=', time.strftime('%Y-%m-01'))]" id="act_res_users_2_project_task_work_month" name="Month works" res_model="project.task.work" src_model="res.users" view_mode="tree,form" view_type="form"/>
<!-- Editable list of messages -->
<record id="view_project_editable_message_tree" model="ir.ui.view">
<field name="name">project.message.form</field>
<field name="model">project.message</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Messages" editable="top">
<field name="subject" select="1"/>
<field name="description" select="1"/>
<field name="project_id" select="1"/>
<field name="date" select="1"/>
<field name="user_id" select="1"/>
</tree>
</field>
</record>
</data> </data>
</openerp> </openerp>
+1 -1
View File
@@ -27,7 +27,7 @@
<!--Invoice control--> <!--Invoice control-->
<menuitem id="menu_procurement_management_invoice" name="Invoice Control" <menuitem id="menu_procurement_management_invoice" name="Invoice Control"
parent="menu_purchase_root" sequence="6"/> parent="menu_purchase_root" sequence="6"/>
<menuitem name="Pending Invoices" id="menu_procurement_management_panding_invoice" action="account.action_invoice_tree_panding_invoice" <menuitem name="Pending Invoices" id="menu_procurement_management_panding_invoice" action="account.action_invoice_tree_panding_invoice"
parent="menu_procurement_management_invoice"/> parent="menu_procurement_management_invoice"/>
<!--product menu--> <!--product menu-->
+2 -3
View File
@@ -91,11 +91,10 @@ class report_closed_task(osv.osv):
tsk.date_deadline as date_deadline, tsk.planned_hours as planned_hours, tsk.date_deadline as date_deadline, tsk.planned_hours as planned_hours,
tsk.delay_hours as delay_hours, tsk.progress as progress, tsk.delay_hours as delay_hours, tsk.progress as progress,
tsk.priority as priority, tsk.state as state, tsk.priority as priority, tsk.state as state,
tsk.remaining_hours as remaining_hours, tsk.date_end as date_close tsk.remaining_hours as remaining_hours
from from
project_task tsk project_task tsk
where
(tsk.date_end <= CURRENT_DATE AND tsk.date_end > (CURRENT_DATE-15))
) )
''') ''')
report_closed_task() report_closed_task()
+12
View File
@@ -162,5 +162,17 @@
<menuitem action="action_resource_calendar_leave_tree" id="menu_resource_calendar_leave_tree" parent="base.menu_pm_resources"/> <menuitem action="action_resource_calendar_leave_tree" id="menu_resource_calendar_leave_tree" parent="base.menu_pm_resources"/>
<!-- project member -->
<record id="view_project_member_tree" model="ir.ui.view">
<field name="name">project.member.tree</field>
<field name="model">resource.resource</field>
<field name="type">tree</field>
<field eval="99" name="priority"/>
<field name="arch" type="xml">
<tree string="Project's Members">
<field name="name"/>
</tree>
</field>
</record>
</data> </data>
</openerp> </openerp>
+49
View File
@@ -1641,4 +1641,53 @@ class stock_picking_move_wizard(osv.osv_memory):
stock_picking_move_wizard() stock_picking_move_wizard()
class report_products_to_received_planned(osv.osv):
_name = "report.products.to.received.planned"
_description = "Product to Received Vs Planned"
_auto = False
_columns = {
'date':fields.date('Date'),
'qty': fields.integer('Actual Qty'),
'planned_qty': fields.integer('Planned Qty'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_products_to_received_planned')
cr.execute("""
create or replace view report_products_to_received_planned as (
select
distinct current_date as date,
min(id) as id,
(select sum(product_qty) from stock_move where to_char(date,'YYYY-MM-DD')::date = current_date ) as qty,
(select sum(product_qty) from stock_move where to_char(date_planned,'YYYY-MM-DD')::date = current_date) as planned_qty
from stock_move
)
""")
report_products_to_received_planned()
class report_delivery_products_planned(osv.osv):
_name = "report.delivery.products.planned"
_description = "Number of Delivery products vs planned"
_auto = False
_columns = {
'date':fields.date('Date'),
'qty': fields.integer('Actual Qty'),
'planned_qty': fields.integer('Planned Qty'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_delivery_products_planned')
cr.execute("""
create or replace view report_delivery_products_planned as (
select
distinct current_date as date,
min(sm.id) as id,
(select sum(product_qty) from stock_move join stock_picking sp on (sm.picking_id = sp.id ) where to_char(sm.date,'YYYY-MM-DD')::date = current_date ) as qty,
(select sum(product_qty) from stock_move join stock_picking sp on (sm.picking_id = sp.id ) where to_char(sm.date_planned,'YYYY-MM-DD')::date = current_date) as planned_qty
from stock_move sm join stock_picking sp on (sm.picking_id = sp.id ) where sp.type = 'out' group by sm.picking_id, sm.date, sm.date_planned
)
""")
report_delivery_products_planned()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+73
View File
@@ -1486,5 +1486,78 @@
<field eval="True" name="object"/> <field eval="True" name="object"/>
</record>   </record>  
<!-- Graph Views -->
<!-- Products To Received Vs Planned -->
<record model="ir.ui.view" id="view_move_graph_reception_picking_tree">
<field name="name">Products To Received</field>
<field name="model">report.products.to.received.planned</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Products To Received" >
<field name="qty" />
<field name="planned_qty" />
<field name="date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_move_graph_reception_picking">
<field name="name">Products To Received</field>
<field name="model">report.products.to.received.planned</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Products To Received" type="bar" orientation="vertical">
<field name="date"/>
<field name="qty" operator="+"/>
<field name="planned_qty" operator="+"/>
</graph>
</field>
</record>
<record id="action_move_graph_reception_picking" model="ir.actions.act_window">
<field name="name">Reception Picking Stock Move</field>
<field name="res_model">report.products.to.received.planned</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="view_id" ref="view_move_graph_reception_picking"/>
</record>
<!-- Delivery Product Vs Planned -->
<record model="ir.ui.view" id="view_move_delivery_products_planned_tree">
<field name="name">Delivery Products</field>
<field name="model">report.delivery.products.planned</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Products To Received" >
<field name="qty" />
<field name="planned_qty" />
<field name="date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_move_delivery_products_planned_graph">
<field name="name">Delivery Products</field>
<field name="model">report.delivery.products.planned</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Products To Received" type="bar" orientation="vertical">
<field name="date"/>
<field name="qty" operator="+"/>
<field name="planned_qty" operator="+"/>
</graph>
</field>
</record>
<record id="action_move_delivery_products_planned" model="ir.actions.act_window">
<field name="name">Delivery Products Vs Planned</field>
<field name="res_model">report.delivery.products.planned</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="view_id" ref="view_move_delivery_products_planned_graph"/>
</record>
</data> </data>
</openerp> </openerp>