I am getting the error:
AccessError: ('AccessError', "No value found for account.invoice(u'66',).state")
I have this code here:
def _get_invoice_status(self, cr, uid, ids, invoice_status, arg, context=None):
inv_status = {}
inv_obj = self.pool.get('account.invoice')
for record in self.browse(cr, uid, ids, context=context) :
_inv = record.invoice and inv_obj.browse(cr, uid, record.invoice, context=context) or False
inv_status[record.id] = _inv and _inv.state or '' <-- error is from this line. How can I fix it?
return inv_status
_name = 'intrac.batches.registrations'
_columns = {
'name': fields.char('Registration Number', readonly=True),
'invoice': fields.integer('Invoice'),
'invoice_status' : fields.function(_get_invoice_status, type='char', store=False, string='Invoice Status'),
}
@Abdullah, can you share the log (server or javascript console) that indicates that the line causing the problem is indeed that line? I've commented in your other question that u'..' is a unicode. Also, I can't find the exact error message in OpenERP v7 (your code is v7/old API style), are you using other version?