This question has been flagged
2320 Views

Hi,

I want to edit the method def name_search in order to get specific account depending to invoice type.

But I could not call the invoice object in order to get type.

Any help please and thanks

def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):

invoice_obj = self.pool.get('account_invoice')

invoice_ids = invoice_obj.search(cr, user, name,[], context=context)

for inv in invoice_obj.browse(cr, user, invoice_ids,context=None):

print 'typeeeeee:',inv.type

codes=[610001, 610002, 610003, 610004, 610005]

args += [('code','in' , codes)]

ids = self.search(cr, user, args, context=context, limit=limit)

print 'fff:',ids

return self.name_get(cr, user, ids, context=context)

Avatar
Discard