[Fix] Due date can not be greter than posting date validation should consider supplier invoice date for purchase invoice

This commit is contained in:
Rohit Waghchaure 2018-11-26 18:42:29 +05:30
parent 64b4d98778
commit d1a85a3637
2 changed files with 2 additions and 2 deletions

View File

@ -335,7 +335,7 @@ def get_due_date_from_template(template_name, posting_date, bill_date):
def validate_due_date(posting_date, due_date, party_type, party, company=None, bill_date=None, template_name=None): def validate_due_date(posting_date, due_date, party_type, party, company=None, bill_date=None, template_name=None):
if getdate(due_date) < getdate(posting_date): if getdate(due_date) < getdate(posting_date):
frappe.throw(_("Due Date cannot be before Posting Date")) frappe.throw(_("Due Date cannot be before Posting / Supplier Invoice Date"))
else: else:
if not template_name: return if not template_name: return

View File

@ -179,7 +179,7 @@ class AccountsController(TransactionBase):
validate_due_date(self.posting_date, self.due_date, validate_due_date(self.posting_date, self.due_date,
"Customer", self.customer, self.company, self.payment_terms_template) "Customer", self.customer, self.company, self.payment_terms_template)
elif self.doctype == "Purchase Invoice": elif self.doctype == "Purchase Invoice":
validate_due_date(self.posting_date, self.due_date, validate_due_date(self.bill_date or self.posting_date, self.due_date,
"Supplier", self.supplier, self.company, self.bill_date, self.payment_terms_template) "Supplier", self.supplier, self.company, self.bill_date, self.payment_terms_template)
def set_price_list_currency(self, buying_or_selling): def set_price_list_currency(self, buying_or_selling):