@@ -19,6 +19,8 @@ def set_custom_info_for_agrolait(self):
19
19
"""Used when you need to use some created custom info."""
20
20
self .agrolait .custom_info_template_id = self .tpl
21
21
self .agrolait ._onchange_custom_info_template_id ()
22
+ # need to invalidate cache here: o2m with an integer (res_id) as inverse_name
23
+ self .agrolait .custom_info_ids .invalidate_cache ()
22
24
self .agrolait .get_custom_info_value (
23
25
self .env .ref ("base_custom_info.prop_haters" )
24
26
).value_int = 5
@@ -29,6 +31,8 @@ def test_access_granted(self):
29
31
agrolait = self .agrolait .with_user (self .demouser )
30
32
agrolait .custom_info_template_id = self .tpl
31
33
agrolait ._onchange_custom_info_template_id ()
34
+ # need to invalidate cache here: o2m with an integer (res_id) as inverse_name
35
+ self .agrolait .custom_info_ids .invalidate_cache ()
32
36
prop_weaknesses = agrolait .env .ref ("base_custom_info.prop_weaknesses" )
33
37
val_weaknesses = agrolait .get_custom_info_value (prop_weaknesses )
34
38
opt_food = agrolait .env .ref ("base_custom_info.opt_food" )
@@ -68,6 +72,8 @@ def test_apply_unapply_template(self):
68
72
# Applying a template autofills the values
69
73
self .agrolait .custom_info_template_id = self .tpl
70
74
self .agrolait ._onchange_custom_info_template_id ()
75
+ # need to invalidate cache here: o2m with an integer (res_id) as inverse_name
76
+ self .agrolait .custom_info_ids .invalidate_cache ()
71
77
self .assertEqual (len (self .agrolait .custom_info_ids ), len (self .tpl .property_ids ))
72
78
self .assertEqual (
73
79
self .agrolait .custom_info_ids .mapped ("property_id" ), self .tpl .property_ids
@@ -76,6 +82,8 @@ def test_apply_unapply_template(self):
76
82
# Unapplying a template empties the values
77
83
self .agrolait .custom_info_template_id = False
78
84
self .agrolait ._onchange_custom_info_template_id ()
85
+ # need to invalidate cache here: o2m with an integer (res_id) as inverse_name
86
+ self .agrolait .custom_info_ids .invalidate_cache ()
79
87
self .assertFalse (self .agrolait .custom_info_template_id )
80
88
self .assertFalse (self .agrolait .custom_info_ids )
81
89
@@ -128,6 +136,8 @@ def test_default_values(self):
128
136
"""Default values get applied."""
129
137
self .agrolait .custom_info_template_id = self .tpl
130
138
self .agrolait ._onchange_custom_info_template_id ()
139
+ # need to invalidate cache here: o2m with an integer (res_id) as inverse_name
140
+ self .agrolait .custom_info_ids .invalidate_cache ()
131
141
val_weaknesses = self .agrolait .get_custom_info_value (
132
142
self .env .ref ("base_custom_info.prop_weaknesses" )
133
143
)
@@ -145,6 +155,8 @@ def test_recursive_templates(self):
145
155
self .agrolait .invalidate_cache ()
146
156
self .assertIn (tpl_gamer , self .agrolait .all_custom_info_templates ())
147
157
self .agrolait ._onchange_custom_info_template_id ()
158
+ # need to invalidate cache here: o2m with an integer (res_id) as inverse_name
159
+ self .agrolait .custom_info_ids .invalidate_cache ()
148
160
self .assertTrue (
149
161
tpl_gamer .property_ids < self .agrolait .mapped ("custom_info_ids.property_id" )
150
162
)
0 commit comments