[IMP]:purchase:improved purchase dashboard.

bzr revid: apa@apa-20100702122630-vh0jz3sugn396fe8
This commit is contained in:
rch(OpenERP) 2010-07-02 17:56:30 +05:30 committed by apa
parent 786543f93b
commit 0042fdf5c6
3 changed files with 105 additions and 14 deletions

View File

@ -35,12 +35,13 @@
<form string="My Board">
<hpaned>
<child1>
<action colspan="4" height="220" name="%(purchase_draft)d" string="Draft Purchase Order" width="510"/>
<action colspan="4" height="220" name="%(purchase_waiting)d" string="Purchase Order in Waiting" width="510"/>
<action colspan="4" height="220" name="%(purchase.action_current_purchases)d" string="Current purchases" width="510"/>
<action colspan="4" height="220" name="%(purchase.action_po_per_month_tree)d" string="Purchase order per month" width="510"/>
</child1>
<child2>
<action colspan="4" height="220" name="%(purchase.action_purchase_order_report_all)d" string="Total Qty and Amount by month" />
<action colspan="4" height="220" name="%(purchase.action_stock_move_report_po)d" string="Total Orders by User per month" />
<action colspan="4" height="220" name="%(purchase.action_purchase_by_supplier)d" string="Purchase by supplier" />
<action colspan="4" height="220" name="%(purchase.action_total_price_by_product_by_state)d" string="Total price by product by state" />
<action colspan="4" height="220" name="%(purchase.action_qty_per_product)d" string="Total Quantity per product" />
</child2>
</hpaned>
</form>

View File

@ -34,16 +34,14 @@ class purchase_report(osv.osv):
'date': fields.date('Order Date', readonly=True),
'name': fields.char('Year',size=64,required=False, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'state': fields.selection([
('draft','Quotation'),
('waiting_date','Waiting Schedule'),
('manual','Manual in progress'),
('progress','In progress'),
('shipping_except','Shipping Exception'),
('invoice_except','Invoice Exception'),
('done','Done'),
('cancel','Cancel')
], 'Order State', readonly=True),
'state': fields.selection([('draft', 'Request for Quotation'),
('wait', 'Waiting'),
('confirmed', 'Waiting Supplier Ack'),
('approved', 'Approved'),
('except_picking', 'Shipping Exception'),
('except_invoice', 'Invoice Exception'),
('done', 'Done'),
('cancel', 'Cancelled')],'Order State', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
'location_id': fields.many2one('stock.location', 'Destination', readonly=True),

View File

@ -176,6 +176,98 @@
</record>
<menuitem action="action_stock_move_report_po" id="menu_action_stock_move_report_po" parent="base.next_id_73" sequence="8"/>
<record model="ir.ui.view" id="view_purchase_by_supplier_graph">
<field name="name">purchase.by.supplier.graph</field>
<field name="model">purchase.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Purchase by supplier" >
<field name="partner_id"/>
<field name="nbr" operator="+"/>
</tree>
</field>
</record>
<record id="action_purchase_by_supplier" model="ir.actions.act_window">
<field name="name">Purchase by supplier</field>
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="domain">[('state','=','done'),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]</field>
<field name="context">{'group_by_no_leaf':1,'group_by':['partner_id']}</field>
<field name="view_id" ref="view_purchase_by_supplier_graph"/>
</record>
<record model="ir.ui.view" id="view_total_price_by_product_by_state_graph">
<field name="name">total.price.by.product.by.state.graph</field>
<field name="model">purchase.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Total price by product by state" >
<field name="product_id"/>
<field name="price_total" operator="+"/>
<field name="state" group="True"/>
</tree>
</field>
</record>
<record id="action_total_price_by_product_by_state" model="ir.actions.act_window">
<field name="name">Total price by product by state</field>
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'group_by_no_leaf':1,'group_by':['product_id','state']}</field>
<field name="view_id" ref="view_total_price_by_product_by_state_graph"/>
</record>
<record model="ir.ui.view" id="view_qty_per_product_graph">
<field name="name">qty.per.product.graph</field>
<field name="model">purchase.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Qty. per product" >
<field name="product_id"/>
<field name="quantity" operator="+"/>
</tree>
</field>
</record>
<record id="action_qty_per_product" model="ir.actions.act_window">
<field name="name">Qty. per product</field>
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="domain">[('state','=','done')]</field>
<field name="context">{'group_by_no_leaf':1,'group_by':['product_id']}</field>
<field name="view_id" ref="view_qty_per_product_graph"/>
</record>
<record model="ir.ui.view" id="view_po_per_month_tree">
<field name="name">qty.per.product.tree</field>
<field name="model">purchase.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Purchase order per month" >
<field name="month"/>
<field name="product_id" invisible="1"/>
<field name="nbr" operator="+"/>
</tree>
</field>
</record>
<record id="action_po_per_month_tree" model="ir.actions.act_window">
<field name="name">Purchase order per month</field>
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="domain">[('date','&gt;',time.strftime('%Y-01-01 00:00:00')),('date','&lt;',time.strftime('%Y-12-31 23:59:59')),('state','=','done')]</field>
<field name="context">{'group_by_no_leaf':1,'group_by':['month','product_id']}</field>
<field name="view_id" ref="view_po_per_month_tree"/>
</record>
<record id="action_current_purchases" model="ir.actions.act_window">
<field name="name">Current purchases</field>
<field name="res_model">purchase.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','in',('draft','confirmed'))]</field>
<field name="view_id" ref="purchase.purchase_order_tree"/>
</record>
</data>
</openerp>