From 7ff5e1b590790d92295139915b97a2f9d10da797 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Fri, 22 Sep 2023 13:53:09 +0200 Subject: [PATCH] [FIX] stock: remove py3.9 function `removeprefix` string function has been introduce in Python 3.9 but we still support Python 3.7 This commit replaces it by an hand crafted one Part-of: odoo/odoo#136067 --- addons/stock/models/stock_move.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 6d152c1962a..097409324ca 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -922,9 +922,13 @@ Please change the quantity done or the rounding precision of your unit of measur assert mode in ('serial', 'import') default_vals = {} # Get default values + def remove_prefix(text, prefix): + if text.startswith(prefix): + return text[len(prefix):] + return text for key in context: if key.startswith('default_'): - default_vals[key.removeprefix('default_')] = context[key] + default_vals[remove_prefix(key, 'default_')] = context[key] vals_list = [] if mode == 'serial':