Hello I am trying to make an on change. Everything is ok, The field call the method and all. BUt when this had that feed another field this give me error:
I am trying to feed a relational(Many2one) with the results of a query. Here is my code:
invoice = fields.Many2one('account.invoice', string='Factura')
client = fields.Many2one('res.partner', string='Cliente', domain=[('customer', '=', True)])
@api.onchange('client')
def _searchInvoice(self):
if self.client is not None:
invoice = self.env['account.invoice'].search([('type', '=', 'out_invoice'),
('partner_id', '=', self.client.id)])
self.invoice = invoice