From d569a71250ae4e3d81138687739d8dc43f2ce48f Mon Sep 17 00:00:00 2001 From: "Djamel (otd)" Date: Wed, 10 Mar 2021 08:02:42 +0000 Subject: [PATCH] [FIX] accounting: fix the creation of the first sample vendor bill during the tour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to follow to reproduce the bug: -In V14 -Go to accounting -In the tour, click on Create First Bill -Choose ‘Try a sample vendor bill’ and click on continue -an error is triggered Problem: The returned value of ”create_invoice_from_attachment” method is treated as an “account.move” recordset, but it is a dict used for ‘ir.actions.act_window' Solution: We retrieve the ‘account.move’ from the ‘res_id’ found in the dict. The issue was introduced by this commit : https://github.com/odoo/odoo/commit/8435d0e8990509ee67425977f970ab27bea8133a opw-2469567 closes odoo/odoo#68595 X-original-commit: 2252cae941efcca36f981d50c546cacf70ff760d Signed-off-by: William André (wan) --- addons/account/wizard/account_tour_upload_bill.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/wizard/account_tour_upload_bill.py b/addons/account/wizard/account_tour_upload_bill.py index a4cdcbc99b4..76c1eedf0c0 100644 --- a/addons/account/wizard/account_tour_upload_bill.py +++ b/addons/account/wizard/account_tour_upload_bill.py @@ -65,9 +65,9 @@ class AccountTourUploadBill(models.TransientModel): 'res_model': 'mail.compose.message', 'datas': self.sample_bill_preview, }) - bill = purchase_journal.with_context(default_journal_id=purchase_journal.id, default_move_type='in_invoice').create_invoice_from_attachment(attachment.ids) - if self.selection == 'sample': - bill.write({ + bill_action = purchase_journal.with_context(default_journal_id=purchase_journal.id, default_move_type='in_invoice').create_invoice_from_attachment(attachment.ids) + bill = self.env['account.move'].browse(bill_action['res_id']) + bill.write({ 'partner_id': self.env.ref('base.main_partner').id, 'ref': 'INV/2020/0011' })