[IMP] improves the Purchase Analysis reporting view, removes old Day, Month, Year field from the postgres view and updates the dashboard graph view (addon purchase)

bzr revid: ged@openerp.com-20140129124739-6sir9fz6jak9ic0y
This commit is contained in:
Gery Debongnie 2014-01-29 13:47:39 +01:00
parent 8a80b28493
commit 90f2184e93
3 changed files with 14 additions and 64 deletions

View File

@ -17,15 +17,12 @@
<field name="model">purchase.report</field>
<field name="arch" type="xml">
<tree string="Monthly Purchase by Category">
<field name="month"/>
<field name="category_id"/>
<field name="price_total"/>
<field name="user_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_uom" invisible="1"/>
<field name="day" invisible="1"/>
<field name="name" invisible="1"/>
<field name="warehouse_id" invisible="1"/>
<field name="validator" invisible="1"/>
<field name="company_id" invisible="1"/>
@ -39,9 +36,9 @@
<field name="model">purchase.report</field>
<field name="arch" type="xml">
<graph string="Monthly Purchase by Category" type="bar">
<field name="month"/>
<field name="price_total" operator="+"/>
<field name="category_id" group="True"/>
<field name="date" interval="month" type="row"/>
<field name="category_id" type="col"/>
<field name="price_total" type="measure"/>
</graph>
</field>
</record>
@ -50,7 +47,7 @@
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="context">{'group_by':['month','category_id'],'group_by_no_leaf':1}</field>
<field name="context">{'group_by_no_leaf':1}</field>
<field name="domain">[('state','in',('approved','except_picking','except_invoice','done'))]</field>
<field name="view_id" ref="view_purchase_order_monthly_categ_graph"></field>
</record>

View File

@ -32,8 +32,6 @@ class purchase_report(osv.osv):
_auto = False
_columns = {
'date': fields.date('Order Date', readonly=True, help="Date on which this document has been created"),
'name': fields.char('Year',size=64,required=False, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'state': fields.selection([('draft', 'Request for Quotation'),
('confirmed', 'Waiting Supplier Ack'),
('approved', 'Approved'),
@ -60,12 +58,10 @@ class purchase_report(osv.osv):
'negociation': fields.float('Purchase-Standard Price', readonly=True, group_operator="avg"),
'price_standard': fields.float('Products Value', readonly=True, group_operator="sum"),
'nbr': fields.integer('# of Lines', 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),
'category_id': fields.many2one('product.category', 'Category', readonly=True)
}
_order = 'name desc,price_total desc'
_order = 'date desc, price_total desc'
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'purchase_report')
cr.execute("""
@ -73,9 +69,6 @@ class purchase_report(osv.osv):
select
min(l.id) as id,
s.date_order as date,
to_char(s.date_order, 'YYYY') as name,
to_char(s.date_order, 'MM') as month,
to_char(s.date_order, 'YYYY-MM-DD') as day,
s.state,
s.date_approve,
s.minimum_planned_date as expected_date,
@ -121,9 +114,6 @@ class purchase_report(osv.osv):
l.product_id,
t.categ_id,
s.date_order,
to_char(s.date_order, 'YYYY'),
to_char(s.date_order, 'MM'),
to_char(s.date_order, 'YYYY-MM-DD'),
s.state,
s.warehouse_id,
u.uom_type,

View File

@ -6,7 +6,12 @@
<field name="model">purchase.report</field>
<field name="arch" type="xml">
<graph string="Purchase Orders Statistics" type="pivot">
<field name="partner_id" type="row"/>
<field name="product_id" type="row"/>
<field name="nbr" type="measure"/>
<field name="quantity" type="measure"/>
<field name="price_average" type="measure"/>
<field name="price_standard" type="measure"/>
<field name="price_total" type="measure"/>
</graph>
</field>
@ -43,66 +48,24 @@
<filter string="Destination" icon="terp-gtk-jump-to-ltr" context="{'group_by':'location_id'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Order of Day"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Order of Month"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'name'}" help="Order of Year"/>
<filter string="Order Date (day)" icon="terp-go-today" context="{'group_by':'date:day'}" help="Order of Day"/>
<filter string="Order Date (month)" icon="terp-go-month" context="{'group_by':'date:month'}" help="Order of Day"/>
<filter string="Order Date (year)" icon="terp-go-year" context="{'group_by':'date:year'}" help="Order of Day"/>
</group>
</search>
</field>
</record>
<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.report</field>
<field name="arch" type="xml">
<graph string="Total Qty and Amount by month" type="bar">
<field name="month"/>
<field name="quantity" operator="+"/>
<field name="price_total" operator="+"/>
</graph>
</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.report</field>
<field name="arch" type="xml">
<graph string="Total Orders Lines by User per month" orientation="vertical" type="bar">
<field name="month" />
<field name="nbr" operator="+"/>
<field name="user_id" group="True" />
</graph>
</field>
</record>
<record id="action_purchase_order_report_all" model="ir.actions.act_window">
<field name="name">Purchase Analysis</field>
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_purchase_order_graph"></field>
<field name="context">{'search_default_year':1,'search_default_month':1,'search_default_group_partner_id':1,'search_default_group_product_id': 1, 'search_default_orders': 1, 'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_year':1,'search_default_month':1, 'search_default_orders': 1, 'group_by_no_leaf':1,'group_by':[]}</field>
<field name="help">Purchase Analysis allows you to easily check and analyse your company purchase history and performance. From this menu you can track your negotiation performance, the delivery performance of your suppliers, etc.</field>
</record>
<record id="action_purchase_order_report_graph" model="ir.actions.act_window">
<field name="name">Total Qty and Amount by month</field>
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_purchase_order_qty_amount_graph"></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.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_purchase_order_by_user_graph"></field>
</record>
<menuitem id="base.next_id_73" name="Purchase" parent="base.menu_reporting" sequence="10"
groups="purchase.group_purchase_manager"/>
<menuitem action="action_purchase_order_report_all" id="menu_action_purchase_order_report_all" parent="base.next_id_73" sequence="3"/>