From aaa4cb45a1b363b8220d76e1ec0788895b8e3389 Mon Sep 17 00:00:00 2001
From: "Gauthier Wala (gawa)" <gawa@odoo.com>
Date: Wed, 3 May 2023 14:08:02 +0000
Subject: [PATCH] [FIX] sale: Some followers of moves should not be added

- Create a Deferred Revenue Model on a Current Liability account
- Create a Sale Order yourself (User 1), with Salesperson User 2
- Create the invoice from it
- Remove the salesperson from the invoice and add User 3 instead
- Change the account to the Revenue Model's one
- Post the invoice
- Post the deferred revenue created
=> User 2 is follower of the entries generated

The problem is that the context comes from the sales order, and
contains a `default_user_id` in the context.
The solution provided is to remove it from the context given, as
it serves no purpose (the invoices are already created).

opw-3141495

closes odoo/odoo#121560

X-original-commit: c3df8fc0da2f359ac0a47695ef37aa8869063092
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
---
 addons/sale/models/sale_order.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/addons/sale/models/sale_order.py b/addons/sale/models/sale_order.py
index de1575b9951a..2704d9a3ccf0 100644
--- a/addons/sale/models/sale_order.py
+++ b/addons/sale/models/sale_order.py
@@ -1029,7 +1029,6 @@ class SaleOrder(models.Model):
                 'default_partner_shipping_id': self.partner_shipping_id.id,
                 'default_invoice_payment_term_id': self.payment_term_id.id or self.partner_id.property_payment_term_id.id or self.env['account.move'].default_get(['invoice_payment_term_id']).get('invoice_payment_term_id'),
                 'default_invoice_origin': self.name,
-                'default_user_id': self.user_id.id,
             })
         action['context'] = context
         return action
-- 
GitLab