Hi,
I create new report module for the warehouse delivery order picking list but when i pick it it show the error message
Field 'move_lines' does not exist in object 'browse_record(product.product, 1)'
(, AttributeError(KeyError("Field 'move_lines' does not exist in object 'browse_record(product.product, 1)'",),), )
**product_moves.py**
import time
from openerp.report import report_sxw
from openerp.osv import osv
from openerp import pooler
class product_moves(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_product_desc':self.get_product_desc
})
def get_product_desc(self,move_line):
desc = move_line.product_id.name
if move_line.product_id.default_code:
desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc
return desc
report_sxw.report_sxw('report.product_moves', 'stock.picking',
'addons/extra_reports/reports/product_moves.rml',
parser=product_moves)
**product_moves.rml**
Description Lot Status Location Quantity [[repeatIn(objects,'picking')]] [[picking.type == 'out' and picking.partner_id and setLang(picking.partner_id.lang) or '']] Supplier Address : [[ (picking.type == 'in' or removeParentNode('para')) and '' ]] Customer Address : [[ (picking.type == 'out' or removeParentNode('para')) and '' ]] Warehouse Address : [[ (picking.type == 'internal' or removeParentNode('para')) and '' ]] [[ (picking.partner_id and picking.partner_id.id and picking.partner_id.title.name) or '' ]] [[ picking.partner_id and picking.partner_id.id and picking.partner_id.name ]] [[ picking.partner_id and display_address(picking.partner_id) ]] [[ picking.partner_id.phone or picking.partner_id.email or removeParentNode('para')]] Contact Address : [[ picking.partner_id and picking.partner_id.title.name or '' ]] [[ picking.partner_id and picking.partner_id.name or '' ]] [[ picking.partner_id and display_address(picking.partner_id) ]] [[ picking.partner_id.phone or picking.partner_id.email or removeParentNode('para')]] Delivery Order 123: [[ (picking.type == 'out' or removeParentNode('para')) and '' ]] [[ picking.name ]] Incoming Shipment : [[ (picking.type == 'in' or removeParentNode('para')) and '' ]] [[ picking.name ]] Internal Shipment : [[ (picking.type == 'internal' or removeParentNode('para')) and '' ]] [[ picking.name ]] Journal Order(Origin) Schedule Date Weight [[ picking.stock_journal_id.name]] [[ picking.origin or '']] [[ formatLang(picking.min_date,date_time = True) ]] [[ 'weight' in picking._columns.keys() and picking.weight or '']] Description Serial Number Status Location Quantity [[ 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') ]] [[ (picking.move_lines!=[] and removeParentNode('para')) or removeParentNode('section')]] [[ get_product_desc(move_lines) ]] [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]] [[ move_lines.state ]] [[ (move_lines.location_id and move_lines.location_id.name) or '' ]] [[ formatLang(move_lines.product_qty) ]] [[ move_lines.product_uom.name ]] [[ ([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting' )]) and 'Non Assigned Products:' or removeParentNode('para') ]] [[ repeatIn([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting')],'move_lines') ]] [[ (picking.move_lines!=[] and removeParentNode('para')) or removeParentNode('section')]] [[ get_product_desc(move_lines) ]] [[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]] [[ (picking.type == 'in' or removeParentNode('para')) ]][[ move_lines.state == 'done' and 'Received' or move_lines.state]] [[ (picking.type == 'out' or removeParentNode('para')) ]][[ move_lines.state == 'done' and 'Delivered' or move_lines.state]] [[ (picking.type == 'internal' or removeParentNode('para')) ]][[ move_lines.state == 'done' and 'Transferred' or move_lines.state]] [[ (move_lines.location_id and move_lines.location_id.name) or '' ]] [[ formatLang(move_lines.product_qty) ]] [[ move_lines.product_uom.name ]]
↧