From 8242a9cd465e706a7be1a37a31298b3f0109df12 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Fri, 15 Mar 2024 12:00:38 +0530 Subject: [PATCH] fix: use in_import flag for checking imported records (cherry picked from commit f504f2caf37116019123df8369f868e99cbdf509) --- erpnext/controllers/accounts_controller.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index fcff9ffb428..ca75bc5233a 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -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":