Comment 1 for bug 594504

Revision history for this message
Ferdinand (office-chricar) wrote : Re: 5.0.11 - Print Screen - Export - Exception: 'int' object is unsubscriptable

just want to correct myself
after comparing a printable with not printable line I believe it's not data dependant.

the lines with fixed text from the following statement are printable the others not.

    def _partner_name(self, cr, uid, ids, field_name, arg, context={}):
         result = {}
         for partner in self.browse(cr, uid, ids, context):
             #pname=''
             pname = None
             if partner.partner_id and not (partner.sale_line_id or partner.purchase_line_id) :
                   pname = partner.partner_id.name
             if partner.sale_line_id:
                 pname = partner.sale_line_id.order_id.partner_id.name
             if partner.purchase_line_id:
                 pname = partner.purchase_line_id.order_id.partner_id.name
             if not pname and partner.location_id.usage == 'internal':
                 if partner.location_dest_id.usage == 'production':
                     pname = ' Used for Production'
                 if partner.location_dest_id.usage == 'inventory':
                     pname = ' Inventory'
                 if partner.location_dest_id.usage == 'internal':
                     pname = ' Internal'
             if not pname and (partner.location_id.usage == 'production' and partner.location_dest_id.usage == 'internal' ):
                 pname = ' Production'

             result[partner.id] = pname
         return result

....
        'partner_name' : fields.function(_partner_name, method=True, string="Partner",type='char', size=132,store=True ),