Merge pull request #1881 from anandpdoshi/anand-wip

Fixes to end_of_life conditions
This commit is contained in:
Rushabh Mehta 2014-07-02 18:16:54 +05:30
commit 0e085e15bb
3 changed files with 5 additions and 3 deletions

View File

@ -149,7 +149,7 @@ class ProductionOrder(Document):
@frappe.whitelist()
def get_item_details(item):
res = frappe.db.sql("""select stock_uom, description
from `tabItem` where (ifnull(end_of_life, "")="" or end_of_life > now())
from `tabItem` where (ifnull(end_of_life, "0000-00-00")="0000-00-00" or end_of_life > now())
and name=%s""", item, as_dict=1)
if not res:

View File

@ -283,7 +283,7 @@ def validate_end_of_life(item_code, end_of_life=None, verbose=1):
if not end_of_life:
end_of_life = frappe.db.get_value("Item", item_code, "end_of_life")
if end_of_life and getdate(end_of_life) <= now_datetime().date():
if end_of_life and end_of_life!="0000-00-00" and getdate(end_of_life) <= now_datetime().date():
msg = _("Item {0} has reached its end of life on {1}").format(item_code, formatdate(end_of_life))
_msgprint(msg, verbose)

View File

@ -190,7 +190,9 @@ def reorder_item():
and exists (select name from `tabItem`
where `tabItem`.name = `tabBin`.item_code and
is_stock_item='Yes' and (is_purchase_item='Yes' or is_sub_contracted_item='Yes') and
(ifnull(end_of_life, '')='' or end_of_life > curdate()))""", as_dict=True)
(ifnull(end_of_life, '0000-00-00')='0000-00-00' or end_of_life > curdate()))""",
as_dict=True)
for bin in bin_list:
#check if re-order is required
item_reorder = frappe.db.get("Item Reorder",