I'm trying to override an onchange method, on account_voucher model, so as to add a new field return, for the field "encaisseur".
It's a new field that I added, and it a many2one to res.users. like this :
'encaisseur': fields.many2one('res.users','Commercial', required=True, ondelete='cascade'),
Here after the code for the onchnge method I tried to do :
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context=None):
if context==None:
context={ }
res = super(AccountVoucher, self).onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context=None)
res.update({'value': {'encaisseur': False}})
commercial = False
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context)
commercial = partner.user_id
res.update({'value': {'encaisseur' : commercial}})
return res
When trying to change a partner so as to give me its commercial, it pop ups an XML http request error like this :
XmlHttpRequestError INTERNAL SERVER ERROR
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p
Any suggestions please ? where I did it wrong ? thanks