[IMP] stock, internal picking list report: added putaway/removal strategies features in the internal picking report
bzr revid: qdp-launchpad@openerp.com-20131223142646-msgy0ts2vdm4c3dy
This commit is contained in:
parent
7046f0bf81
commit
ac83efee61
|
@ -21,12 +21,15 @@
|
|||
|
||||
import time
|
||||
from openerp.report import report_sxw
|
||||
from openerp.tools.translate import _
|
||||
|
||||
class picking(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(picking, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_internal_picking_src_lines': self.get_internal_picking_src_lines,
|
||||
'get_internal_picking_dest_lines': self.get_internal_picking_dest_lines,
|
||||
'get_product_desc': self.get_product_desc,
|
||||
})
|
||||
def get_product_desc(self, move_line):
|
||||
|
@ -35,6 +38,56 @@ class picking(report_sxw.rml_parse):
|
|||
desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc
|
||||
return desc
|
||||
|
||||
report_sxw.report_sxw('report.stock.picking.list','stock.picking','addons/stock/report/picking.rml',parser=picking)
|
||||
report_sxw.report_sxw('report.stock.picking.list.internal','stock.picking','addons/stock/report/picking_internal.rml',parser=picking, header='internal')
|
||||
def get_internal_picking_src_lines(self, picking):
|
||||
res = []
|
||||
for line in picking.move_lines:
|
||||
if line.state not in ('confirmed', 'done', 'assigned', 'waiting') or line.scrapped:
|
||||
continue
|
||||
state_label = line.state == 'done' and _('Done') or (line.state == 'confirmed' and _('Waiting Availability') or (line.state == 'assigned' and _('Available') or _('Waiting Availability')))
|
||||
row = {
|
||||
'state': state_label,
|
||||
'description': self.get_product_desc(line),
|
||||
}
|
||||
if not line.lot_ids:
|
||||
row['quantity'] = line.product_uom_qty
|
||||
row['lot_id'] = ''
|
||||
row['uom'] = line.product_uom.name
|
||||
row['location_id'] = line.location_id.name
|
||||
row['barcode'] = line.product_id.ean13
|
||||
res.append(row)
|
||||
else:
|
||||
for quant in line.lot_ids:
|
||||
row2 = row.copy()
|
||||
row2['quantity'] = quant.qty
|
||||
row2['uom'] = line.product_id.uom_id.name
|
||||
row2['location_id'] = quant.location_id.name
|
||||
row2['lot_id'] = quant.lot_id and quant.lot_id.name or ''
|
||||
row2['barcode'] = quant.lot_id and quant.lot_id.name or line.product_id.ean13
|
||||
res.append(row2)
|
||||
return res
|
||||
|
||||
def get_internal_picking_dest_lines(self, picking):
|
||||
res = []
|
||||
for line in picking.move_lines:
|
||||
row = {'description': self.get_product_desc(line)}
|
||||
if not line.putaway_ids:
|
||||
row['quantity'] = line.product_uom_qty
|
||||
row['uom'] = line.product_uom.name
|
||||
row['location_id'] = line.location_dest_id.name
|
||||
row['barcode'] = line.product_id.ean13
|
||||
row['lot_id'] = ''
|
||||
res.append(row)
|
||||
else:
|
||||
for rec in line.putaway_ids:
|
||||
row2 = row.copy()
|
||||
row2['quantity'] = rec.quantity
|
||||
row2['uom'] = line.product_id.uom_id.name
|
||||
row2['location_id'] = rec.location_id.name
|
||||
row2['lot_id'] = rec.lot_id and rec.lot_id.name or ''
|
||||
row2['barcode'] = rec.lot_id and rec.lot_id.name or line.product_id.ean13
|
||||
res.append(row2)
|
||||
return res
|
||||
|
||||
report_sxw.report_sxw('report.stock.picking.list', 'stock.picking', 'addons/stock/report/picking.rml', parser=picking)
|
||||
report_sxw.report_sxw('report.stock.picking.list.internal', 'stock.picking', 'addons/stock/report/picking_internal.rml', parser=picking, header='internal')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -68,16 +68,6 @@
|
|||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Move_Line_Contect_Assign_State">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
|
@ -139,17 +129,17 @@
|
|||
<td>
|
||||
<para style="terp_tblheader_Details">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Lot</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Status</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Location</para>
|
||||
<para style="terp_tblheader_Details_Right">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Quantity</para>
|
||||
<para style="terp_tblheader_Details_Right">Source Location</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Serial Number</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Barcode</para>
|
||||
|
@ -218,80 +208,74 @@
|
|||
<para style="terp_default_5cm_Above_Space">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="155.0,73.0,59.0,59.0,71.0,100" repeatRows="1" style="Move_Line_Header">
|
||||
<blockTable colWidths="155.0,70.0,65.0,60.0,70.0,100.0" repeatRows="1" style="Move_Line_Header">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Serial Number</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Status</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Location</para>
|
||||
<para style="terp_tblheader_Details_Right">Status</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Source Location</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Serial Number</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Barcode</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_2">[[ repeatIn([line for line in picking.move_lines if ((line.state == 'confirmed' or line.state=='done' or line.state=='assigned') and not line.scrapped)],'move_lines') ]]</para>
|
||||
<para style="terp_default_2">[[ (picking.move_lines!=[] and removeParentNode('para')) or removeParentNode('section')]]</para>
|
||||
<blockTable colWidths="155.0,74.0,58.0,60.0,73.0,100.0" style="Move_Line_Contect_Assign_State">
|
||||
<para style="terp_default_2">[[ repeatIn(get_internal_picking_src_lines(picking), 'move_line') ]]</para>
|
||||
<blockTable colWidths="155.0,70.0,65.0,60.0,70.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9"><font face="Helvetica" size="9.0">[[ get_product_desc(move_lines) ]] </font></para>
|
||||
<para style="terp_default_9"><font face="Helvetica" size="9.0">[[ move_line['description'] ]] </font></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ move_lines.quant_ids and ','.join(map(str, [q.lot_id.name for q in move_lines.quant_ids if q.lot_id])) or '' ]]</para>
|
||||
<para style="terp_default_Right_9">[[ move_line['state'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">Waiting Availability[[ move_lines.state == 'confirmed' and ' ' or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_9">Done[[ move_lines.state == 'done' and ' ' or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_9">Available[[ move_lines.state == 'assigned' and ' ' or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_Right_9">[[ move_line['quantity'] ]] [[ move_line['uom'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]] </para>
|
||||
<para style="terp_default_Centre_9">[[ move_line['location_id'] ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(move_lines.product_qty) ]] [[ move_lines.product_uom.name ]]</para>
|
||||
<para style="terp_default_Centre_9">[[ move_line['lot_id'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<barCode code="code128" quiet="9" fontName="Times-Roman" fontSize="50" alignment="CENTER">[[ move_lines.product_id.ean13 or removeParentNode('barCode')]]</barCode>
|
||||
<barCode code="code128" quiet="9" fontName="Times-Roman" fontSize="50" alignment="CENTER">[[ move_line['barcode'] or removeParentNode('barCode')]]</barCode>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<para style="terp_default_Bold_9">[[ ([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting' )]) and 'Non Assigned Products:' or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_Bold_9">[[ ([line for line in picking.move_lines if line.state == 'draft']) and 'Non Assigned Products:' or removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_2"/>
|
||||
<section>
|
||||
<para style="terp_default_2">[[ repeatIn([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting')],'move_lines') ]]</para>
|
||||
<para style="terp_default_2">[[ (picking.move_lines!=[] and removeParentNode('para')) or removeParentNode('section')]]</para>
|
||||
<blockTable colWidths="155.0,73.0,59.0,59.0,71.0,100.0" style="Table1">
|
||||
<para style="terp_default_2">[[ repeatIn([line for line in picking.move_lines if line.state == 'draft'],'move_lines') ]]</para>
|
||||
<blockTable colWidths="155.0,70.0,65.0,60.0,70.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9"><font face="Helvetica" size="9.0">[[ get_product_desc(move_lines) ]] </font></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ (picking.picking_type_id.code == 'incoming' or removeParentNode('para')) ]][[ move_lines.state == 'done' and 'Received' or move_lines.state]]</para>
|
||||
<para style="terp_default_9">[[ (picking.picking_type_id.code == 'outgoing' or removeParentNode('para')) ]][[ move_lines.state == 'done' and 'Delivered' or move_lines.state]]</para>
|
||||
<para style="terp_default_9">[[ (picking.picking_type_id.code == 'internal' or removeParentNode('para')) ]][[ move_lines.state == 'done' and 'Transferred' or move_lines.state]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]] </para>
|
||||
<para style="terp_default_Right_9">Unconfirmed</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(move_lines.product_qty) ]] [[ move_lines.product_uom.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ move_lines.location_id.name ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9"></para>
|
||||
</td>
|
||||
<td>
|
||||
<barCode code="code128" quiet="9" fontName="Times-Roman" fontSize="50" alignment="CENTER">[[ move_lines.product_id.ean13 or removeParentNode('barCode')]]</barCode>
|
||||
</td>
|
||||
|
@ -302,5 +286,79 @@
|
|||
<font color="white"> </font>
|
||||
</para>
|
||||
</pto>
|
||||
<pto>
|
||||
<pto_header>
|
||||
<blockTable colWidths="225.0,65.0,60.0,70.0,100.0" repeatRows="1" style="Move_Line_Header">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Suggested Destination</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Serial Number</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Barcode</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</pto_header>
|
||||
<para style="terp_default_5cm_Above_Space">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_header">Suggested Destination Locations</para>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="225.0,65.0,60.0,70.0,100.0" repeatRows="1" style="Move_Line_Header">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Suggested Destination</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Serial Number</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Barcode</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_2">[[ repeatIn(get_internal_picking_dest_lines(picking), 'move_line') ]]</para>
|
||||
<blockTable colWidths="225.0,65.0,60.0,70.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9"><font face="Helvetica" size="9.0">[[ move_line['description'] ]] </font></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ move_line['quantity'] ]] [[ move_line['uom'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ move_line['location_id'] ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ move_line['lot_id'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<barCode code="code128" quiet="9" fontName="Times-Roman" fontSize="50" alignment="CENTER">[[ move_line['barcode'] or removeParentNode('barCode')]]</barCode>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
</pto>
|
||||
</story>
|
||||
</document>
|
||||
|
|
Loading…
Reference in New Issue