mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +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)
|
||||||
@@ -298,7 +299,7 @@ class DocType:
|
|||||||
order by timestamp(posting_date, posting_time) asc, name asc""", \
|
order by timestamp(posting_date, posting_time) asc, name asc""", \
|
||||||
(self.doc.item_code, self.doc.warehouse, \
|
(self.doc.item_code, self.doc.warehouse, \
|
||||||
prev_sle.get('posting_date','1900-01-01'), prev_sle.get('posting_time', '12:00')), as_dict = 1)
|
prev_sle.get('posting_date','1900-01-01'), prev_sle.get('posting_time', '12:00')), as_dict = 1)
|
||||||
for sle in sll:
|
for sle in sll:
|
||||||
# block if stock level goes negative on any date
|
# block if stock level goes negative on any date
|
||||||
if val_method != 'Moving Average' or flt(allow_negative_stock) == 0:
|
if val_method != 'Moving Average' or flt(allow_negative_stock) == 0:
|
||||||
self.validate_negative_stock(cqty, sle)
|
self.validate_negative_stock(cqty, sle)
|
||||||
|
|||||||
@@ -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