add postgres view for max create date of inventory line of product
bzr revid: mra@tinyerp.com-20081103144049-2944fggkw1tn7dyw
This commit is contained in:
parent
f79a046ae1
commit
ca0368ac6a
|
@ -65,5 +65,42 @@
|
|||
name="Stock" res_model="stock.report.prodlots"
|
||||
src_model="stock.production.lot"/>
|
||||
|
||||
|
||||
<!-- report , stock inventories date... start -->
|
||||
<record model="ir.ui.view" id="report_stock_lines_date_tree">
|
||||
<field name="name">report.stock.lines.date.tree</field>
|
||||
<field name="model">report.stock.lines.date</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Dates of Inventories">
|
||||
<field name="id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="create_date" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="report_stock_lines_date_graph">
|
||||
<field name="name">report.stock.lines.date.graph</field>
|
||||
<field name="model">report.stock.lines.date</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Dates of Inventories" type="bar" >
|
||||
<field name="create_date"/>
|
||||
<field name="product_id"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_stock_line_date">
|
||||
<field name="name">Dates of Inventories</field>
|
||||
<field name="res_model">report.stock.lines.date</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
</record>
|
||||
<menuitem parent="next_id_61" action="action_stock_line_date" id="menu_report_stock_line_date"/>
|
||||
|
||||
<!-- end... -->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1360,4 +1360,30 @@ class stock_picking_move_wizard(osv.osv_memory):
|
|||
return {'type':'ir.actions.act_window_close' }
|
||||
|
||||
stock_picking_move_wizard()
|
||||
|
||||
|
||||
class report_stock_lines_date(osv.osv):
|
||||
_name = "report.stock.lines.date"
|
||||
_description = "Dates of Inventories"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'id': fields.integer('Id',size=20),
|
||||
'product_id':fields.integer('Product Id',size=20),
|
||||
'create_date': fields.datetime('Latest Date of Inventory'),
|
||||
}
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_stock_lines_date as (
|
||||
select
|
||||
p.id as id,
|
||||
p.id as product_id,
|
||||
max(l.create_date) as create_date
|
||||
from
|
||||
product_product p
|
||||
left outer join
|
||||
stock_inventory_line l on (p.id=l.product_id)
|
||||
where l.create_date is not null
|
||||
group by p.id
|
||||
)""")
|
||||
report_stock_lines_date()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue