changes for postgres view on stock module

bzr revid: mra@tinyerp.com-20081104052909-p92082i0d8qvqrt1
This commit is contained in:
Mustufa Rangwala 2008-11-04 10:59:09 +05:30
parent 7460c0e716
commit da8aa7411a
2 changed files with 21 additions and 7 deletions

View File

@ -73,17 +73,31 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Dates of Inventories">
<field name="id"/>
<field name="product_id"/>
<field name="id"/>
<field name="create_date" />
</tree>
</field>
</record>
<record model="ir.ui.view" id="report_stock_lines_date_form">
<field name="name">report.stock.lines.date.form</field>
<field name="model">report.stock.lines.date</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Dates of Inventories">
<field name="product_id" select="1"/>
<field name="id" select="2"/>
<field name="create_date" select="1" />
</form>
</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_mode">tree</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem parent="next_id_61" action="action_stock_line_date" id="menu_report_stock_line_date"/>

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -1359,15 +1359,15 @@ class report_stock_lines_date(osv.osv):
_description = "Dates of Inventories"
_auto = False
_columns = {
'id': fields.integer('Id',size=20),
'product_id':fields.integer('Product Id',size=20),
'id': fields.integer('Inventory Line Id', readonly=True),
'product_id':fields.integer('Product Id', readonly=True),
'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,
l.id as id,
p.id as product_id,
max(l.create_date) as create_date
from
@ -1375,7 +1375,7 @@ class report_stock_lines_date(osv.osv):
left outer join
stock_inventory_line l on (p.id=l.product_id)
where l.create_date is not null
group by p.id
group by p.id,l.id
)""")
report_stock_lines_date()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: