mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
posting time format validation
This commit is contained in:
@@ -44,6 +44,7 @@ class DocType:
|
|||||||
def update_stock(self, actual_qty=0, reserved_qty=0, ordered_qty=0, indented_qty=0, planned_qty=0, dt=None, sle_id='', posting_time='', serial_no = '', is_cancelled = 'No',doc_type='',doc_name='',is_amended='No'):
|
def update_stock(self, actual_qty=0, reserved_qty=0, ordered_qty=0, indented_qty=0, planned_qty=0, dt=None, sle_id='', posting_time='', serial_no = '', is_cancelled = 'No',doc_type='',doc_name='',is_amended='No'):
|
||||||
if not dt:
|
if not dt:
|
||||||
dt = nowdate()
|
dt = nowdate()
|
||||||
|
|
||||||
# update the stock values (for current quantities)
|
# update the stock values (for current quantities)
|
||||||
self.doc.actual_qty = flt(self.doc.actual_qty) + flt(actual_qty)
|
self.doc.actual_qty = flt(self.doc.actual_qty) + flt(actual_qty)
|
||||||
self.doc.ordered_qty = flt(self.doc.ordered_qty) + flt(ordered_qty)
|
self.doc.ordered_qty = flt(self.doc.ordered_qty) + flt(ordered_qty)
|
||||||
|
|||||||
@@ -90,9 +90,17 @@ class DocType:
|
|||||||
if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in webnotes.user.get_roles():
|
if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in webnotes.user.get_roles():
|
||||||
msgprint("You are not authorized to do / modify back dated stock entries before %s" % getdate(stock_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)
|
msgprint("You are not authorized to do / modify back dated stock entries before %s" % getdate(stock_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)
|
||||||
|
|
||||||
|
def validate_posting_time(self):
|
||||||
|
""" Validate posting time format"""
|
||||||
|
if self.doc.posting_time and len(cstr(self.doc.posting_time)) == 8 and cstr(self.doc.posting_time)[-2:] != '00':
|
||||||
|
msgprint("Wrong format of posting time, can not complete the transaction. If you think \
|
||||||
|
you entered posting time correctly, please contact ERPNext support team.")
|
||||||
|
raise Exception
|
||||||
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_mandatory()
|
self.validate_mandatory()
|
||||||
|
self.validate_posting_time()
|
||||||
self.validate_item()
|
self.validate_item()
|
||||||
self.actual_amt_check()
|
self.actual_amt_check()
|
||||||
self.check_stock_frozen_date()
|
self.check_stock_frozen_date()
|
||||||
|
|||||||
Reference in New Issue
Block a user