fix: use in_import flag for checking imported records

(cherry picked from commit f504f2caf3)
This commit is contained in:
Gursheen Anand
2024-03-15 12:00:38 +05:30
committed by Mergify
parent 9cdde50f7c
commit 8242a9cd46

View File

@@ -611,10 +611,9 @@ class AccountsController(TransactionBase):
posting_date = (
self.posting_date if self.doctype == "Sales Invoice" else (self.bill_date or self.posting_date)
)
via_data_import = (
self.flags.updater_reference and self.flags.updater_reference.get("doctype") == "Data Import"
)
if via_data_import and getdate(self.due_date) < getdate(posting_date):
# skip due date validation for records via Data Import
if frappe.flags.in_import and getdate(self.due_date) < getdate(posting_date):
self.due_date = posting_date
elif self.doctype == "Sales Invoice":