From bfbc959d180fc2725834d175f2b18d12e7681a6a Mon Sep 17 00:00:00 2001 From: Dang Van Loc Date: Mon, 22 Jan 2024 14:30:42 +0700 Subject: [PATCH] [FIX] stock_*: use sudo log activity Problem: In some places I think it is necessary to use sudo to avoid permission errors when creating actions or something else from a other model. For example, I have a picking created from PO attached to MO. When receiving inventory in a smaller quantity than actual quantity, will create activity schedule on MO. But if you don't have the rights, you will get an error closes odoo/odoo#150697 X-original-commit: ac1862ddc2dec0269a156d5470b940a7d85cc078 Signed-off-by: William Henrotin (whe) --- addons/stock/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 8f49f30f9e0..158f05ea14f 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -1365,7 +1365,7 @@ class Picking(models.Model): """ for (parent, responsible), rendering_context in documents.items(): note = render_method(rendering_context) - parent.activity_schedule( + parent.sudo().activity_schedule( 'mail.mail_activity_data_warning', date.today(), note=note,