here's my method:
@api.multi
def action_invoice_open(self):
res = super(AccountInvoice, self).action_invoice_open()
for record in self:
obj = record.env['account.asset.category'].search(
[('method_number', '=', record.invoice_line_ids.total_months)], limit=1).id
if record.invoice_line_ids.deferred_revenue == True:
for rec in record:
rec.env['account.asset.asset'].create({
'name': rec.name or 'kkkkk',
'category_id': obj,
'date': rec.date,
'value': rec.invoice_line_ids.price_subtotal,
'partner_id': rec.partner_id.id,
'invoice_id': rec.id,
})
return res
it gives this error
ValueError: Expected singleton: account.invoice.line(494, 495, 496)
Error is in the bold line. Any help?
P.S: I'm getting these values from line and it works fine with single line value but gives error when i add multiple lines.