Reputation: 5496
I am trying to modify a method in an existing module to adapt functionality. What does + operator do in this line?
for line in payment.move_line_ids + expense_sheet.account_move_id.line_ids:
Upvotes: 3
Views: 104
Reputation: 962
Hello M.E.,
List/String/Tupple
.Plus(+) Operator use with two List
a = [1,2,3]
b = [4,5]
print a + b
output = [1,2,3,4,5]
+
operator use with two String
a = "Vora"
b = " mayur"
print a + b
output = "vora mayur"
+
operator use with two tupple
a = (1,2,3)
b = (4,5)
print a + b
output = (1,2,3,4,5)
Upvotes: 6
Reputation: 2633
It concatenates account.move.line
records from payment.move_line_ids
and expense_sheet.account_move_id.line_ids
into a single recordset, which is then iterated over. Please note that the result of the __add__
(+) operation might contain duplicates if the same account.move.line
is present in both operands. If you want to avoid duplicates, use the |
(OR) operator.
Upvotes: 5