[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) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2020-10-15 06:50:13 +00:00
parent 17e30c988a
commit 23ef558689
+2 -1
View File
@@ -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()