This is my first time using a function field. so please help me to see if I put the right calls and arguments.
I am just trying to get the state of the invoice which id I input in field "invoice"
I am getting this error:
DataError: invalid input syntax for integer: "invoice"
LINE 2: WHERE account_invoice.id IN ('invoice') ...
This is the code:
def _get_invoice_status(self, cr, uid, ids, invoice_status, arg, context=None):
inv_status = {}
for record in self.pool.get('account.invoice').browse(cr, uid, ['invoice'], context=context) :
inv_status[record.id] = record.state or ''
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'),
}
Can someone help?