From cddbd7bf940be0daca6e11ab3739a269ec36ba06 Mon Sep 17 00:00:00 2001 From: wan Date: Fri, 7 Feb 2020 09:45:49 +0000 Subject: [PATCH] [FIX] account: no next activity on invoice for OdooBot We don't want a next activity for an invoice to be created for OdooBot if he is the Salesperson. We also don't want a traceback if the salesperson and the next activity user are not set. closes odoo/odoo#45417 X-original-commit: 8bf1b72e2b2bdf026b8eff28a554301a598012be Signed-off-by: Quentin De Paoli (qdp) --- addons/account/models/account_move.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index cb04a42a920..a5f4ba01f1c 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2142,8 +2142,7 @@ class AccountMove(models.Model): # installing Accounting- with bank statements) move.company_id.account_bank_reconciliation_start = move.date - for move in self: - if move.is_sale_document() and move.journal_id.sale_activity_type_id: + if move.is_sale_document() and move.journal_id.sale_activity_type_id and (move.journal_id.sale_activity_user_id or move.invoice_user_id).id not in (self.env.ref('base.user_root').id, False): move.activity_schedule( date_deadline=min((date for date in move.line_ids.mapped('date_maturity') if date), default=move.date), activity_type_id=move.journal_id.sale_activity_type_id.id,