From 23ef55868967fc5ab8fa7e382bb4989163f47e81 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 14 Oct 2020 12:57:47 +0000 Subject: [PATCH] [FIX] account: improve warnings.warn call As-is, the warning will reports that post() is called from within post, which is not very convenient when trying to find what calls post() (as there are other "post" methods in the system). By increasing the stacklevel from 1 (default) to 2, the warning will report the method's caller, which is a lot more useful. closes odoo/odoo#60043 X-original-commit: 5bc6eb9b387112138ac118726ff746bad6d00f8d Signed-off-by: Xavier Morel (xmo) --- addons/account/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index d62a5236cb5..75e061c7727 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2331,7 +2331,8 @@ class AccountMove(models.Model): def post(self): warnings.warn( "RedirectWarning method 'post()' is a deprecated alias to 'action_post()' or _post()", - DeprecationWarning + DeprecationWarning, + stacklevel=2 ) return self.action_post()