stock: Add the difference between date date_planned and date_expected in report

bzr revid: sbh@tinyerp.com-20100518133350-4mamc77r6kdewh84
This commit is contained in:
sbh (Open ERP)
2010-05-18 19:03:50 +05:30
parent 9d51a8b1b1
commit 0a6693e99d
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -44,7 +44,7 @@ class report_stock_move(osv.osv):
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
\nThe state is \'Waiting\' if the move is waiting for another one.'),
'day_diff':fields.integer('Days difference',readonly=True),
}
def init(self, cr):
@@ -56,6 +56,7 @@ class report_stock_move(osv.osv):
to_char(date_trunc('day',m.date_planned), 'YYYY') as year,
to_char(date_trunc('day',m.date_planned), 'MM') as month,
to_char(date_trunc('day',m.date_planned), 'YYYY-MM-DD') as day,
(date(m.date_planned)-date(m.date_expected)) as day_diff,
m.address_id as partner_id,
m.location_id as location_id,
m.location_dest_id as location_dest_id,
@@ -69,6 +70,6 @@ class report_stock_move(osv.osv):
m.product_id=pp.id and pp.product_tmpl_id=pt.id
group by
m.id, m.product_id,m.address_id, m.location_id, m.location_dest_id,
m.date_planned, m.state, m.product_uom,pt.standard_price )
m.date_planned, m.state, m.product_uom,pt.standard_price,m.date_expected )
""")
report_stock_move()
@@ -8,6 +8,7 @@
<field name="arch" type="xml">
<tree string="Stock Orders Statistics">
<field name="date_planned"/>
<field name="day_diff"/>
<field name="year" invisible="1" />
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>