posting time format validation

This commit is contained in:
Nabin Hait 2012-04-25 15:07:46 +05:30
parent d98ca01082
commit ed7de5fee2
2 changed files with 10 additions and 1 deletions

View File

@ -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'):
if not dt:
dt = nowdate()
# update the stock values (for current quantities)
self.doc.actual_qty = flt(self.doc.actual_qty) + flt(actual_qty)
self.doc.ordered_qty = flt(self.doc.ordered_qty) + flt(ordered_qty)

View File

@ -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():
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):
self.validate_mandatory()
self.validate_posting_time()
self.validate_item()
self.actual_amt_check()
self.check_stock_frozen_date()