I'm trying to create a new invoice in controller:
request.env['account.move'].sudo().create([
{
'move_type': 'out_invoice',
'journal_id': 1,
'invoice_date': '2020-01-10',
'invoice_line_ids': [(0, 0, {'product_id': 21, 'price_unit': 1000.0})],
}])
But i got this error
Expected singleton: res.users()
Please help, thanks.