Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
2f7681b7 by Cédric Krier at 2023-01-23T00:12:44+01:00
Ensure right model is used in Many2One sql_format
Closes #6074
- - - - -
1 changed file:
- trytond/trytond/model/fields/many2one.py
Changes:
=====================================
trytond/trytond/model/fields/many2one.py
=====================================
@@ -118,4 +118,5 @@
super(Many2One, self).__set__(inst, value)
def sql_format(self, value):
+ from ..model import Model
assert value is not False
@@ -121,4 +122,6 @@
assert value is not False
+ assert (
+ not isinstance(value, Model) or value.__name__ == self.model_name)
if value and not isinstance(value, (Query, Expression)):
value = int(value)
return super().sql_format(value)
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/2f7681b78d1c46f994c900ada2932f89e4181b0c
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/2f7681b78d1c46f994c900ada2932f89e4181b0c
You're receiving this email because of your account on foss.heptapod.net.