Merge pull request #1881 from anandpdoshi/anand-wip
Fixes to end_of_life conditions
This commit is contained in:
commit
0e085e15bb
@ -149,7 +149,7 @@ class ProductionOrder(Document):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_item_details(item):
|
def get_item_details(item):
|
||||||
res = frappe.db.sql("""select stock_uom, description
|
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)
|
and name=%s""", item, as_dict=1)
|
||||||
|
|
||||||
if not res:
|
if not res:
|
||||||
|
@ -283,7 +283,7 @@ def validate_end_of_life(item_code, end_of_life=None, verbose=1):
|
|||||||
if not end_of_life:
|
if not end_of_life:
|
||||||
end_of_life = frappe.db.get_value("Item", item_code, "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))
|
msg = _("Item {0} has reached its end of life on {1}").format(item_code, formatdate(end_of_life))
|
||||||
_msgprint(msg, verbose)
|
_msgprint(msg, verbose)
|
||||||
|
|
||||||
|
@ -190,7 +190,9 @@ def reorder_item():
|
|||||||
and exists (select name from `tabItem`
|
and exists (select name from `tabItem`
|
||||||
where `tabItem`.name = `tabBin`.item_code and
|
where `tabItem`.name = `tabBin`.item_code and
|
||||||
is_stock_item='Yes' and (is_purchase_item='Yes' or is_sub_contracted_item='Yes') 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:
|
for bin in bin_list:
|
||||||
#check if re-order is required
|
#check if re-order is required
|
||||||
item_reorder = frappe.db.get("Item Reorder",
|
item_reorder = frappe.db.get("Item Reorder",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user