[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
This commit is contained in:
William Henrotin
2023-09-27 09:11:48 +00:00
parent 0bd5512ad3
commit 7ff5e1b590
+5 -1
View File
@@ -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':