[FIX] account: bill import wizard: link attachments to the created invoices instead of the file chooser wizard

This commit is contained in:
Olivier Colson
2018-09-10 14:10:11 +02:00
parent 95a9572da3
commit 1a37c127d6
@@ -13,6 +13,7 @@ class ImportInvoiceImportWizard(models.TransientModel):
def _create_invoice_from_file(self, attachment):
invoice_form = Form(self.env['account.invoice'], view='account.invoice_supplier_form')
invoice = invoice_form.save()
attachment.write({'res_model': 'account.invoice', 'res_id': invoice.id})
invoice.message_post(attachment_ids=[attachment.id])
return invoice