[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) <qdp@openerp.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user