Hi Need a help..
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def action_invoice_open(self):
inv_ids = super(AccountInvoice,self).action_invoice_open()
invoice_obj_wish=self.env['wishlist.invoice.line']
order_line_obj=self.env['sale.order.line']
sale_order_id = self.env['sale.order'].search([('name', '=', self.name)], limit=1).id
# env_val=
for order_details_id in self.browse(sale_order_id):
vals = {
'invoice_status':str(self.state),
'wishlist_invoice_id': sale_order_id,
'wishinv_number':str(self.number),
'invoice_date':self.date_invoice,
'invoice_id':self.id
}
for order_val in self.env['sale.order'].browse(sale_order_id):
orderline_write = order_line_obj.search(
[('id', '=', self.invoice_line_ids.wish_ref.id)]) #Here I am getting Error(ValueError: Expected singleton: account.invoice.line(31, 32)) If i validate with Multiple lines
#If i validate with single line its working ...
for line in order_val.order_line:
orderline_write.write({'status_wish':'invoiced_open'})
update_val=invoice_obj_wish.search(['&', ('wishlist_invoice_id', '=', sale_order_id),('invoice_id','=',self.id)])
update_val.write(vals)
return inv_idsclass AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'
wish_ref=fields.Many2one('sale.order.line')