Skip to content

Commit

Permalink
feat: validate overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
fproldan committed Oct 8, 2024
1 parent f1790d2 commit d80acc1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions erpnext/payroll/doctype/sales_commission/sales_commission.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ def validate_from_to_dates(self):
return super().validate_from_to_dates("from_date", "to_date")

def validate_omit_transaction_duplicates(self):
# TODO chequear por solapamiento de fechas
if not self.omit_sales_person_transactions:
return

previous_contibutions = frappe.get_all(
"Sales Commission",
filters={
"sales_person": self.sales_person,
"docstatus": 1,
"from_date": self.from_date,
"to_date": self.to_date,
},
filters=[
['from_date', '<=', self.to_date],
['to_date', '>=', self.from_date],
['sales_person', '=', self.sales_person],
['docstatus', '=', 1],
],
pluck="name"
)
if previous_contibutions:
Expand Down

0 comments on commit d80acc1

Please sign in to comment.