mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 07:29:22 +00:00
tabify modifications, minor coding style/message updates
This commit is contained in:
@@ -90,13 +90,12 @@ class DocType(DocListController):
|
|||||||
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)
|
||||||
|
|
||||||
stock_frozen_upto_days = webnotes.conn.get_value('Stock Settings', None, 'stock_frozen_upto_days') or 0
|
stock_frozen_upto_days = webnotes.conn.get_value('Stock Settings', None, 'stock_frozen_upto_days') or 0
|
||||||
if stock_frozen_upto_days:
|
if stock_frozen_upto_days:
|
||||||
stock_auth_role = webnotes.conn.get_value('Stock Settings', None,'stock_auth_role')
|
stock_auth_role = webnotes.conn.get_value('Stock Settings', None,'stock_auth_role')
|
||||||
posting_date = getdate(self.doc.posting_date)
|
older_than_x_days_ago = (add_date(getdate(self.doc.posting_date), stock_frozen_upto_days) <= date.today())
|
||||||
frozen_days = timedelta(days=stock_frozen_upto_days)
|
if older_than_x_days_ago and not stock_auth_role in webnotes.user.get_roles():
|
||||||
if posting_date + frozen_days <= date.today() and not stock_auth_role in webnotes.user.get_roles():
|
msgprint("You are not authorized to do / modify back dated stock entries older than %d days ago" %stock_frozen_upto_days, raise_exception=1)
|
||||||
msgprint("You are not authorized to do / modify back dated stock entries %d ago" %stock_frozen_upto_days, raise_exception=1)
|
|
||||||
|
|
||||||
|
|
||||||
def scrub_posting_time(self):
|
def scrub_posting_time(self):
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ class DocType:
|
|||||||
set_by_naming_series("Item", "item_code",
|
set_by_naming_series("Item", "item_code",
|
||||||
self.doc.get("item_naming_by")=="Naming Series", hide_name_field=True)
|
self.doc.get("item_naming_by")=="Naming Series", hide_name_field=True)
|
||||||
|
|
||||||
stock_frozen_limit = 356
|
stock_frozen_limit = 356
|
||||||
submitted_stock_frozen = self.doc.fields.get("stock_frozen_upto_days")
|
submitted_stock_frozen = self.doc.stock_frozen_upto_days
|
||||||
if submitted_stock_frozen > stock_frozen_limit:
|
if submitted_stock_frozen > stock_frozen_limit:
|
||||||
self.doc.fields["stock_frozen_upto_days"] = stock_frozen_limit
|
self.doc.stock_frozen_upto_days = stock_frozen_limit
|
||||||
webnotes.msgprint (_("Stocks cannot be freezed for days larger than %d.") %stock_frozen_limit)
|
webnotes.msgprint (_("`Stocks Freeze Older Than` should be smaller than %d days.") %stock_frozen_limit)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-06-24 16:37:54",
|
"creation": "2013-06-24 16:37:54",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2014-01-27 17:29:56",
|
"modified": "2014-01-27 20:00:56",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_frozen_upto_days",
|
"fieldname": "stock_frozen_upto_days",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"label": "Stock Frozen Upto [Days Ago]"
|
"label": "Freeze Stocks Older Than [Days]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
|||||||
Reference in New Issue
Block a user