Even though there is default receivable account on partner i want to change it other account
if self.move_id.move_type == 'out_invoice' and self.account_id.user_type_id.id == '1':
so = self.env['sale.order'].search([('name','=',self.move_id.invoice_origin)])
if so:
custom = self.env['custom'].search([('name','=',so.origin)])
if custom:
custom_account = self.env['ir.config_parameter'].sudo().get_param('custom_account')
if not custom_account:
raise UserError('Configure the custom account!')
self.account_id = int(custom_account)
I want to insert this structure into account.move.line but can't figure out how. i tried to add it into onchange from account_id, but the function wasn't triggering