Last active
October 14, 2024 13:30
-
-
Save 3mrdev/2a4c19200042caee4d75a719bc036a52 to your computer and use it in GitHub Desktop.
Date filters one2many field in Payroll salary rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Access employee shipments and filter by payslip date range | |
shipment_count = len(employee.shipments.filtered( | |
lambda s: s.scheduled_date and s.scheduled_date.date() >= payslip.date_start and s.scheduled_date.date() <= payslip.date_end | |
)) | |
# Return the shipment count for further calculations if needed | |
result = shipment_count | |
# Access employee shipments and filter by payslip date range | |
total_trip_cost = sum(employee.x_studio_one2many_field_5kk_1ia59qec4.filtered( | |
lambda s: s.scheduled_date and s.scheduled_date.date() >= payslip.date_from and s.scheduled_date.date() <= payslip.date_to | |
).mapped('x_studio_trip_expenses')) | |
# Return the total trip expenses cost for further calculations if needed | |
result = total_trip_cost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment