[ADD] board_purchase module added
bzr revid: vir@tinyerp.com-20100406111425-kca3bssxaj51kltf
This commit is contained in:
parent
547c8782cf
commit
c69545f00d
|
@ -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:
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# -*- 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 Purchase Management',
|
||||
'version': '1.0',
|
||||
'category': 'Board/Purchase',
|
||||
'description': """
|
||||
This module implements a dashboard for purcgase management that includes:
|
||||
* Current Purchase Orders
|
||||
* Draft Purchase Orders
|
||||
* Graph for quantity and amount per month
|
||||
""",
|
||||
'author': 'Tiny',
|
||||
'depends': [ 'purchase','board',
|
||||
],
|
||||
'update_xml': ['board_purchase_view.xml'],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,57 @@
|
|||
<?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_purchase_deshboard"
|
||||
name="Purchase"
|
||||
parent="base.dashboard"/>
|
||||
|
||||
<record id="purchase_waiting" model="ir.actions.act_window">
|
||||
<field name="name">Quotation Request</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('state','in',('wait','confirmed'))]</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="purchase.purchase_order_tree"/>
|
||||
</record>
|
||||
|
||||
<record id="board_purchase_form" model="ir.ui.view">
|
||||
<field name="name">board.purchase.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="%(purchase.purchase_rfq)d" string="Draft Purchase Order" width="510"/>
|
||||
<action colspan="4" height="220" name="%(purchase_waiting)d" string="Purchase Order in Waiting" width="510"/>
|
||||
</child1>
|
||||
<child2>
|
||||
<action colspan="4" height="220" name="%(purchase.action_purchase_order_qty_amount_all)d" string="Total Qty and Amount by month" width="510"/>
|
||||
<action colspan="4" height="220" name="%(purchase.action_purchase_order_by_user_all)d" string="Total Orders by User per month" width="510"/>
|
||||
</child2>
|
||||
</hpaned>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="open_board_purchase" model="ir.actions.act_window">
|
||||
<field name="name">Purchase 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_purchase_form"/>
|
||||
</record>
|
||||
<menuitem
|
||||
action="open_board_purchase"
|
||||
icon="terp-graph"
|
||||
id="menu_board_purchase"
|
||||
parent="menu_purchase_deshboard"
|
||||
sequence="4"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -157,13 +157,13 @@
|
|||
<field name="partner_id" select="1"/>
|
||||
<field name="product_id" select="1"/>
|
||||
<field name="create_uid" select="1" widget="selection">
|
||||
<filter icon="terp-partner" domain="[('create_uid','=',uid)]" help="My Purchase Orders"/>
|
||||
<filter icon="terp-partner" domain="[('create_uid','=',uid)]" help="My Purchase Orders"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Supplier" icon="terp-purchase" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Supplier" icon="terp-purchase" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Order Date" icon="terp-purchase" domain="[]" context="{'group_by':'date_order'}"/>
|
||||
</group>
|
||||
</search>
|
||||
|
@ -176,10 +176,10 @@
|
|||
<field name="res_model">purchase.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('state','=','draft')]</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_purchase_order_filter"/>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_purchase_order_filter"/>
|
||||
</record>
|
||||
<menuitem action="purchase_rfq" id="menu_purchase_rfq" parent="menu_procurement_management"
|
||||
<menuitem action="purchase_rfq" id="menu_purchase_rfq" parent="menu_procurement_management"
|
||||
name="Request for Quotations" sequence="6"/>
|
||||
|
||||
<record id="purchase_form_action" model="ir.actions.act_window">
|
||||
|
@ -216,7 +216,7 @@
|
|||
<field name="minimum_planned_date"/>
|
||||
<field name="invoiced_rate" widget="progressbar"/>
|
||||
<field name="shipped_rate" widget="progressbar"/>
|
||||
<field name="amount_untaxed" sum="Total Untaxed amount"/>
|
||||
<field name="amount_untaxed" sum="Total Untaxed amount"/>
|
||||
<field name="amount_total" sum="Total amount"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
|
@ -289,7 +289,7 @@
|
|||
name="Product purchases"
|
||||
res_model="purchase.order.line"
|
||||
src_model="product.product"/>
|
||||
<!--
|
||||
<!--
|
||||
<record model="ir.values" id="action_merge_purchase_order">
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Purchase Order</field>
|
||||
|
|
|
@ -59,9 +59,9 @@ class report_purchase_order(osv.osv):
|
|||
}
|
||||
_order = 'name desc,price_total desc'
|
||||
def init(self, cr):
|
||||
tools.sql.drop_view_if_exists(cr, 'report_purchase_order')
|
||||
tools.sql.drop_view_if_exists(cr, 'purchase_report')
|
||||
cr.execute("""
|
||||
create or replace view report_purchase_order as (
|
||||
create or replace view purchase_report as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
s.date_order as date,
|
||||
|
@ -92,5 +92,67 @@ class report_purchase_order(osv.osv):
|
|||
""")
|
||||
report_purchase_order()
|
||||
|
||||
class purchase_order_qty_amount(osv.osv):
|
||||
_name = "purchase.order.qty.amount"
|
||||
_description = "Quantity and amount per month"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'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),
|
||||
'total_qty' : fields.float('Total Qty'),
|
||||
'total_amount' : fields.float('Total Amount'),
|
||||
|
||||
}
|
||||
def init(self, cr):
|
||||
tools.sql.drop_view_if_exists(cr, 'purchase_order_qty_amount')
|
||||
cr.execute("""
|
||||
create or replace view purchase_order_qty_amount as (
|
||||
select
|
||||
min(id) as id,
|
||||
to_char(create_date, 'MM') as month,
|
||||
sum(product_qty) as total_qty,
|
||||
sum(price_unit) as total_amount
|
||||
from
|
||||
purchase_order_line
|
||||
where
|
||||
to_char(create_date,'YYYY') = to_char(current_date,'YYYY')
|
||||
group by
|
||||
to_char(create_date, 'MM')
|
||||
|
||||
)
|
||||
""")
|
||||
purchase_order_qty_amount()
|
||||
|
||||
class purchase_order_by_user(osv.osv):
|
||||
_name = "purchase.order.by.user"
|
||||
_description = "Purchase Order by user per month"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name' : fields.char('User',size=64,required=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),
|
||||
'nbr' : fields.integer('Total Orders'),
|
||||
|
||||
}
|
||||
_order = 'name desc'
|
||||
def init(self, cr):
|
||||
tools.sql.drop_view_if_exists(cr, 'purchase_order_by_user')
|
||||
cr.execute("""
|
||||
create or replace view purchase_order_by_user as (
|
||||
select
|
||||
min(po.id) as id,
|
||||
rs.name as name,
|
||||
count(po.id) as nbr,
|
||||
to_char(po.date_order, 'MM') as month
|
||||
from
|
||||
purchase_order as po,res_users as rs
|
||||
where
|
||||
po.create_uid = rs.id
|
||||
group by
|
||||
rs.name,po.date_order
|
||||
|
||||
)
|
||||
""")
|
||||
purchase_order_by_user()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<data>
|
||||
<record model="ir.ui.view" id="view_purchase_order_graph">
|
||||
<field name="name">product.month.graph</field>
|
||||
<field name="model">report.purchase.order</field>
|
||||
<field name="model">purchase.report</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Purchase Orders Statistics" type="bar">
|
||||
|
@ -15,8 +15,8 @@
|
|||
</record>
|
||||
|
||||
<record id="view_purchase_order_tree" model="ir.ui.view">
|
||||
<field name="name">report.purchase.order.tree</field>
|
||||
<field name="model">report.purchase.order</field>
|
||||
<field name="name">purchase.order.tree</field>
|
||||
<field name="model">purchase.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Purchase Orders Statistics">
|
||||
|
@ -38,8 +38,8 @@
|
|||
</record>
|
||||
|
||||
<record id="view_purchase_order_search" model="ir.ui.view">
|
||||
<field name="name">report.purchase.order.search</field>
|
||||
<field name="model">report.purchase.order</field>
|
||||
<field name="name">purchase.order.search</field>
|
||||
<field name="model">purchase.report</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Purchase Orders">
|
||||
|
@ -91,7 +91,7 @@
|
|||
|
||||
<record id="action_purchase_order_report_all" model="ir.actions.act_window">
|
||||
<field name="name">Purchase Orders</field>
|
||||
<field name="res_model">report.purchase.order</field>
|
||||
<field name="res_model">purchase.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_purchase_order_search"/>
|
||||
|
@ -100,5 +100,70 @@
|
|||
<menuitem id="base.next_id_73" name="Reporting" parent="base.menu_purchase_root" sequence="8"/>
|
||||
<menuitem action="action_purchase_order_report_all" id="menu_action_purchase_order_report_all" parent="base.next_id_73" sequence="3"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_purchase_order_qty_amount_graph">
|
||||
<field name="name">purchase.order.qty.amount.graph</field>
|
||||
<field name="model">purchase.order.qty.amount</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Total Qty and Amount by month" type="bar">
|
||||
<field name="month"/>
|
||||
<field name="total_qty" operator="+"/>
|
||||
<field name="total_amount" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_purchase_order_qty_amount_tree">
|
||||
<field name="name">purchase.order.qty.amount.tree</field>
|
||||
<field name="model">purchase.order.qty.amount</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Total Qty and Amount by month" >
|
||||
<field name="month"/>
|
||||
<field name="total_qty" />
|
||||
<field name="total_amount"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_purchase_order_qty_amount_all" model="ir.actions.act_window">
|
||||
<field name="name">Total Qty and Amount by month</field>
|
||||
<field name="res_model">purchase.order.qty.amount</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_purchase_order_by_user_graph">
|
||||
<field name="name">purchase.order.by.user.graph</field>
|
||||
<field name="model">purchase.order.by.user</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Total Orders by User per month" type="bar">
|
||||
<field name="name"/>
|
||||
<field name="month" group="True"/>
|
||||
<field name="nbr" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_purchase_order_by_user_tree">
|
||||
<field name="name">purchase.order.by.user.tree</field>
|
||||
<field name="model">purchase.order.by.user</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Total Orders by User per month" >
|
||||
<field name="name"/>
|
||||
<field name="month"/>
|
||||
<field name="nbr" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_purchase_order_by_user_all" model="ir.actions.act_window">
|
||||
<field name="name">Total Orders by User per month</field>
|
||||
<field name="res_model">purchase.order.by.user</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
"access_purchase_order_stock_worker","purchase.order stock_worker","model_purchase_order","stock.group_stock_user",1,0,0,0
|
||||
"access_purchase_order_line_stock_worker","purchase.order.line stock_worker","model_purchase_order_line","stock.group_stock_user",1,0,0,0
|
||||
"access_account_tax_purchase_user","account.tax purchase_user","account.model_account_tax","purchase.group_purchase_user",1,0,0,0
|
||||
"access_report_purchase_order","report.purchase.order","model_report_purchase_order","purchase.group_purchase_manager",1,0,0,0
|
||||
"access_purchase_report","purchase.order","model_purchase_report","purchase.group_purchase_manager",1,0,0,0
|
||||
|
|
|
Loading…
Reference in New Issue