new report for the stock location

bzr revid: dsh@tinyerp.com-9c62398a94bc068efc4be0837a07625834b5d79b
This commit is contained in:
Dhara Shah 2007-04-13 11:56:59 +00:00
parent a012a084fc
commit cc33d33ca5
3 changed files with 167 additions and 1 deletions

View File

@ -29,5 +29,6 @@
#import lot_overview
import product_stock
import product_location
import stock_by_location
#import stock_by_locatio
import lot_by_location
import ups

View File

@ -0,0 +1,71 @@
# -*-encoding: iso8859-1 -*-
##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import time
from report import report_sxw
from osv import osv
class lot_by_location(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(lot_by_location, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'stock' : self.stock,
})
# from the stock move
def stock(self,location_id):
print location_id;
stock_detail={}
stock=[];
self.cr.execute(('select pl.name, product_qty from stock_move sm,stock_location sl, product_product p ,product_template pl where sl.id = sm.location_id and sl.id = %d and p.product_tmpl_id = sm.product_id and pl.id=p.product_tmpl_id')%(location_id))
res = self.cr.fetchall();
for r in res:
stock_detail = {'product':"",'qty':""}
stock_detail['product']=r[0]
stock_detail['qty']=r[1]
stock.append(stock_detail)
print "stock------------------------------------------",stock;
return stock;
# from stock inventory line
# def lot_details(self,location_id):
# print location_id;
# res = self.pool.get('stock_inventory_line').read(self.cr,self.uid,[location_id]);
# return res;
report_sxw.report_sxw('report.lot.by.location','stock.location','addons/stock/report/lot_by_location.rml',parser=lot_by_location)

View File

@ -0,0 +1,94 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="34.0" y1="28.0" width="527" height="786"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Times-Roman" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
</stylesheet>
<story>
<para style="P1">
<font color="white"> </font>
</para>
<section>
<blockTable colWidths="264.0,264.0" repeatRows="1" style="Table1">
<tr>
<td>
<para style="Table Contents">Product</para>
</td>
<td>
<para style="Table Contents">Quantity</para>
</td>
</tr>
</blockTable>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P2">
<font color="white"> </font>
</para>
<section>
<para style="P2">[[ repeatIn(objects,'o') ]]</para>
<para style="P2">[[o.name]]</para>
<para style="P2">
<font color="white"> </font>
</para>
<section>
<blockTable colWidths="264.0,264.0" repeatRows="1" style="Table2">
<tr>
<td>
<para style="Table Contents">[[ repeatIn(stock(o.id),'l') ]] [[ l['product']]</para>
</td>
<td>
<para style="Table Contents">[[ l['qty']]</para>
</td>
</tr>
</blockTable>
<para style="P2">
<font color="white"> </font>
</para>
</section>
<para style="P2">
<font color="white"> </font>
</para>
</section>
<para style="P2">
<font color="white"> </font>
</para>
</section>
<para style="P2">
<font color="white"> </font>
</para>
<para style="P1">
<font color="white"> </font>
</para>
</story>
</document>