@@ -46,19 +46,18 @@ def _compute_fsm_location_id(self):
46
46
the partner_shipping_id or the partner_id.commercial_partner_id if
47
47
they are FS locations.
48
48
"""
49
- res = super ().onchange_partner_id ()
50
- domain = [
51
- "|" ,
52
- "|" ,
53
- ("partner_id" , "=" , self .partner_id .id ),
54
- ("partner_id" , "=" , self .partner_shipping_id .id ),
55
- ("partner_id" , "=" , self .partner_id .commercial_partner_id .id ),
56
- ]
57
- if self .partner_id .fsm_location :
58
- domain = [("partner_id" , "=" , self .partner_id .id )]
59
- location_ids = self .env ["fsm.location" ].search (domain )
60
- self .fsm_location_id = location_ids and location_ids [0 ] or False
61
- return res
49
+ for so in self :
50
+ if so .partner_id .fsm_location :
51
+ domain = [("partner_id" , "=" , so .partner_id .id )]
52
+ else :
53
+ domain = [
54
+ "|" ,
55
+ "|" ,
56
+ ("partner_id" , "=" , so .partner_id .id ),
57
+ ("partner_id" , "=" , so .partner_shipping_id .id ),
58
+ ("partner_id" , "=" , so .partner_id .commercial_partner_id .id ),
59
+ ]
60
+ so .fsm_location_id = self .env ["fsm.location" ].search (domain , limit = 1 )
62
61
63
62
def _prepare_line_fsm_values (self , line ):
64
63
"""
@@ -154,15 +153,15 @@ def _field_service_generate(self):
154
153
155
154
# Process lines set to FSM Sale
156
155
new_fsm_sale_sol = self .order_line .filtered (
157
- lambda l : l .product_id .field_service_tracking == "sale"
158
- and (not l .fsm_order_id or l .fsm_order_id .is_closed )
156
+ lambda x : x .product_id .field_service_tracking == "sale"
157
+ and (not x .fsm_order_id or x .fsm_order_id .is_closed )
159
158
)
160
159
new_fsm_orders |= self ._field_service_generate_sale_fsm_orders (new_fsm_sale_sol )
161
160
162
161
# Create new FSM Order for lines set to FSM Line
163
162
new_fsm_line_sol = self .order_line .filtered (
164
- lambda l : l .product_id .field_service_tracking == "line"
165
- and (not l .fsm_order_id or l .fsm_order_id .is_closed )
163
+ lambda x : x .product_id .field_service_tracking == "line"
164
+ and (not x .fsm_order_id or x .fsm_order_id .is_closed )
166
165
)
167
166
168
167
new_fsm_orders |= self ._field_service_generate_line_fsm_orders (new_fsm_line_sol )
0 commit comments