[enhancement] Ability to disable an Item
This commit is contained in:
parent
1aa6e98136
commit
21e09a2bd8
@ -56,11 +56,11 @@ class PurchaseCommon(BuyingController):
|
|||||||
d.set(x, f_lst[x])
|
d.set(x, f_lst[x])
|
||||||
|
|
||||||
item = frappe.db.sql("""select is_stock_item, is_purchase_item,
|
item = frappe.db.sql("""select is_stock_item, is_purchase_item,
|
||||||
is_sub_contracted_item, end_of_life from `tabItem` where name=%s""",
|
is_sub_contracted_item, end_of_life, disabled from `tabItem` where name=%s""",
|
||||||
d.item_code, as_dict=1)[0]
|
d.item_code, as_dict=1)[0]
|
||||||
|
|
||||||
from erpnext.stock.doctype.item.item import validate_end_of_life
|
from erpnext.stock.doctype.item.item import validate_end_of_life
|
||||||
validate_end_of_life(d.item_code, item.end_of_life)
|
validate_end_of_life(d.item_code, item.end_of_life, item.disabled)
|
||||||
|
|
||||||
# validate stock item
|
# validate stock item
|
||||||
if item.is_stock_item==1 and d.qty and not d.warehouse:
|
if item.is_stock_item==1 and d.qty and not d.warehouse:
|
||||||
@ -72,6 +72,7 @@ class PurchaseCommon(BuyingController):
|
|||||||
frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx))
|
frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx))
|
||||||
|
|
||||||
items.append(cstr(d.item_code))
|
items.append(cstr(d.item_code))
|
||||||
|
|
||||||
if items and len(items) != len(set(items)) and \
|
if items and len(items) != len(set(items)) and \
|
||||||
not cint(frappe.db.get_single_value("Buying Settings", "allow_multiple_items") or 0):
|
not cint(frappe.db.get_single_value("Buying Settings", "allow_multiple_items") or 0):
|
||||||
frappe.msgprint(_("Warning: Same item has been entered multiple times."))
|
frappe.msgprint(_("Warning: Same item has been entered multiple times."))
|
||||||
|
@ -166,6 +166,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
from tabItem
|
from tabItem
|
||||||
where tabItem.docstatus < 2
|
where tabItem.docstatus < 2
|
||||||
and ifnull(tabItem.has_variants, 0)=0
|
and ifnull(tabItem.has_variants, 0)=0
|
||||||
|
and tabItem.disabled=0
|
||||||
and (tabItem.end_of_life > %(today)s or ifnull(tabItem.end_of_life, '0000-00-00')='0000-00-00')
|
and (tabItem.end_of_life > %(today)s or ifnull(tabItem.end_of_life, '0000-00-00')='0000-00-00')
|
||||||
and (tabItem.`{key}` LIKE %(txt)s
|
and (tabItem.`{key}` LIKE %(txt)s
|
||||||
or tabItem.item_name LIKE %(txt)s
|
or tabItem.item_name LIKE %(txt)s
|
||||||
@ -303,10 +304,10 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
# Hence the first condition is an "OR"
|
# Hence the first condition is an "OR"
|
||||||
if not filters: filters = {}
|
if not filters: filters = {}
|
||||||
|
|
||||||
condition = ""
|
condition = ""
|
||||||
if filters.get("company"):
|
if filters.get("company"):
|
||||||
condition += "and tabAccount.company = %(company)s"
|
condition += "and tabAccount.company = %(company)s"
|
||||||
|
|
||||||
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
||||||
where (tabAccount.report_type = "Profit and Loss"
|
where (tabAccount.report_type = "Profit and Loss"
|
||||||
or tabAccount.account_type in ("Income Account", "Temporary"))
|
or tabAccount.account_type in ("Income Account", "Temporary"))
|
||||||
@ -314,6 +315,6 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
and tabAccount.`{key}` LIKE %(txt)s
|
and tabAccount.`{key}` LIKE %(txt)s
|
||||||
{condition} {match_condition}"""
|
{condition} {match_condition}"""
|
||||||
.format(condition=condition, match_condition=get_match_cond(doctype), key=searchfield), {
|
.format(condition=condition, match_condition=get_match_cond(doctype), key=searchfield), {
|
||||||
'txt': "%%%s%%" % frappe.db.escape(txt),
|
'txt': "%%%s%%" % frappe.db.escape(txt),
|
||||||
'company': filters.get("company", "")
|
'company': filters.get("company", "")
|
||||||
})
|
})
|
||||||
|
@ -140,7 +140,7 @@ erpnext.production_order = {
|
|||||||
} else msgprint(__("Please enter Production Item first"));
|
} else msgprint(__("Please enter Production Item first"));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
set_default_warehouse: function(frm) {
|
set_default_warehouse: function(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.manufacturing.doctype.production_order.production_order.get_default_warehouse",
|
method: "erpnext.manufacturing.doctype.production_order.production_order.get_default_warehouse",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from frappe.utils import flt, get_datetime, getdate, date_diff, cint
|
from frappe.utils import flt, get_datetime, getdate, date_diff, cint, nowdate
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
|
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
|
||||||
@ -159,22 +159,22 @@ class ProductionOrder(Document):
|
|||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.validate_cancel()
|
self.validate_cancel()
|
||||||
|
|
||||||
frappe.db.set(self,'status', 'Cancelled')
|
frappe.db.set(self,'status', 'Cancelled')
|
||||||
self.update_planned_qty()
|
self.update_planned_qty()
|
||||||
self.delete_time_logs()
|
self.delete_time_logs()
|
||||||
|
|
||||||
def validate_cancel(self):
|
def validate_cancel(self):
|
||||||
if self.status == "Stopped":
|
if self.status == "Stopped":
|
||||||
frappe.throw(_("Stopped Production Order cannot be cancelled, Unstop it first to cancel"))
|
frappe.throw(_("Stopped Production Order cannot be cancelled, Unstop it first to cancel"))
|
||||||
|
|
||||||
# Check whether any stock entry exists against this Production Order
|
# Check whether any stock entry exists against this Production Order
|
||||||
stock_entry = frappe.db.sql("""select name from `tabStock Entry`
|
stock_entry = frappe.db.sql("""select name from `tabStock Entry`
|
||||||
where production_order = %s and docstatus = 1""", self.name)
|
where production_order = %s and docstatus = 1""", self.name)
|
||||||
if stock_entry:
|
if stock_entry:
|
||||||
frappe.throw(_("Cannot cancel because submitted Stock Entry {0} exists").format(stock_entry[0][0]))
|
frappe.throw(_("Cannot cancel because submitted Stock Entry {0} exists").format(stock_entry[0][0]))
|
||||||
|
|
||||||
def update_planned_qty(self):
|
def update_planned_qty(self):
|
||||||
update_bin_qty(self.production_item, self.fg_warehouse, {
|
update_bin_qty(self.production_item, self.fg_warehouse, {
|
||||||
"planned_qty": get_planned_qty(self.production_item, self.fg_warehouse)
|
"planned_qty": get_planned_qty(self.production_item, self.fg_warehouse)
|
||||||
})
|
})
|
||||||
@ -342,8 +342,8 @@ 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, "0000-00-00")="0000-00-00" or end_of_life > now())
|
from `tabItem` where disabled=0 and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %s)
|
||||||
and name=%s""", item, as_dict=1)
|
and name=%s""", (nowdate(), item), as_dict=1)
|
||||||
if not res:
|
if not res:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class TestProductionOrder(unittest.TestCase):
|
|||||||
self.assertEqual(prod_order.name, time_log.production_order)
|
self.assertEqual(prod_order.name, time_log.production_order)
|
||||||
self.assertEqual((prod_order.qty - d.completed_qty), time_log.completed_qty)
|
self.assertEqual((prod_order.qty - d.completed_qty), time_log.completed_qty)
|
||||||
self.assertEqual(time_diff_in_hours(d.planned_end_time, d.planned_start_time),time_log.hours)
|
self.assertEqual(time_diff_in_hours(d.planned_end_time, d.planned_start_time),time_log.hours)
|
||||||
|
|
||||||
manufacturing_settings = frappe.get_doc({
|
manufacturing_settings = frappe.get_doc({
|
||||||
"doctype": "Manufacturing Settings",
|
"doctype": "Manufacturing Settings",
|
||||||
"allow_production_on_holidays": 0
|
"allow_production_on_holidays": 0
|
||||||
@ -136,6 +136,11 @@ class TestProductionOrder(unittest.TestCase):
|
|||||||
self.assertRaises(frappe.ValidationError, prod_order.save)
|
self.assertRaises(frappe.ValidationError, prod_order.save)
|
||||||
|
|
||||||
frappe.db.set_value("Item", "_Test FG Item", "end_of_life", None)
|
frappe.db.set_value("Item", "_Test FG Item", "end_of_life", None)
|
||||||
|
frappe.db.set_value("Item", "_Test FG Item", "disabled", 1)
|
||||||
|
|
||||||
|
self.assertRaises(frappe.ValidationError, prod_order.save)
|
||||||
|
|
||||||
|
frappe.db.set_value("Item", "_Test FG Item", "disabled", 0)
|
||||||
|
|
||||||
prod_order = make_prod_order_test_record(item="_Test Variant Item", qty=1, do_not_save=True)
|
prod_order = make_prod_order_test_record(item="_Test Variant Item", qty=1, do_not_save=True)
|
||||||
self.assertRaises(ItemHasVariantError, prod_order.save)
|
self.assertRaises(ItemHasVariantError, prod_order.save)
|
||||||
|
@ -72,6 +72,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10):
|
|||||||
concat(parent_website_route, "/", page_name) as route
|
concat(parent_website_route, "/", page_name) as route
|
||||||
from `tabItem`
|
from `tabItem`
|
||||||
where show_in_website = 1
|
where show_in_website = 1
|
||||||
|
and disabled=0
|
||||||
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s)
|
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s)
|
||||||
and (variant_of = '' or variant_of is null)
|
and (variant_of = '' or variant_of is null)
|
||||||
and (item_group in ({child_groups})
|
and (item_group in ({child_groups})
|
||||||
|
@ -178,31 +178,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"default": "2099-12-31",
|
|
||||||
"depends_on": "is_stock_item",
|
|
||||||
"fieldname": "end_of_life",
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "End of Life",
|
|
||||||
"no_copy": 0,
|
|
||||||
"oldfieldname": "end_of_life",
|
|
||||||
"oldfieldtype": "Date",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -249,6 +224,28 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"fieldname": "disabled",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Disabled",
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -436,6 +433,31 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"default": "2099-12-31",
|
||||||
|
"depends_on": "is_stock_item",
|
||||||
|
"fieldname": "end_of_life",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "End of Life",
|
||||||
|
"no_copy": 0,
|
||||||
|
"oldfieldname": "end_of_life",
|
||||||
|
"oldfieldtype": "Date",
|
||||||
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -2113,7 +2135,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 1,
|
"max_attachments": 1,
|
||||||
"modified": "2015-10-20 12:14:43.315827",
|
"modified": "2015-10-29 02:25:26.256373",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item",
|
"name": "Item",
|
||||||
|
@ -524,14 +524,17 @@ class Item(WebsiteGenerator):
|
|||||||
if variant and self.get("__islocal"):
|
if variant and self.get("__islocal"):
|
||||||
frappe.throw(_("Item variant {0} exists with same attributes").format(variant), ItemVariantExistsError)
|
frappe.throw(_("Item variant {0} exists with same attributes").format(variant), ItemVariantExistsError)
|
||||||
|
|
||||||
def validate_end_of_life(item_code, end_of_life=None, verbose=1):
|
def validate_end_of_life(item_code, end_of_life=None, disabled=None, verbose=1):
|
||||||
if not end_of_life:
|
if (not end_of_life) or (disabled is None):
|
||||||
end_of_life = frappe.db.get_value("Item", item_code, "end_of_life")
|
end_of_life, disabled = frappe.db.get_value("Item", item_code, ["end_of_life", "disabled"])
|
||||||
|
|
||||||
if end_of_life and end_of_life!="0000-00-00" 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)
|
||||||
|
|
||||||
|
if disabled:
|
||||||
|
_msgprint(_("Item {0} is disabled").format(item_code), verbose)
|
||||||
|
|
||||||
def validate_is_stock_item(item_code, is_stock_item=None, verbose=1):
|
def validate_is_stock_item(item_code, is_stock_item=None, verbose=1):
|
||||||
if not is_stock_item:
|
if not is_stock_item:
|
||||||
is_stock_item = frappe.db.get_value("Item", item_code, "is_stock_item")
|
is_stock_item = frappe.db.get_value("Item", item_code, "is_stock_item")
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
frappe.listview_settings['Item'] = {
|
frappe.listview_settings['Item'] = {
|
||||||
add_fields: ["item_name", "stock_uom", "item_group", "image", "variant_of",
|
add_fields: ["item_name", "stock_uom", "item_group", "image", "variant_of",
|
||||||
"has_variants", "end_of_life", "is_sales_item"],
|
"has_variants", "end_of_life", "disabled", "is_sales_item"],
|
||||||
|
|
||||||
get_indicator: function(doc) {
|
get_indicator: function(doc) {
|
||||||
if(doc.end_of_life && doc.end_of_life < frappe.datetime.get_today()) {
|
if (doc.disabled) {
|
||||||
return [__("Expired"), "grey", "end_of_life,<,Today"]
|
return [__("Disabled"), "grey", "disabled,=,Yes"];
|
||||||
} else if(doc.has_variants) {
|
} else if (doc.end_of_life && doc.end_of_life < frappe.datetime.get_today()) {
|
||||||
return [__("Template"), "blue", "has_variants,=,Yes"]
|
return [__("Expired"), "grey", "end_of_life,<,Today"];
|
||||||
} else if(doc.variant_of) {
|
} else if (doc.has_variants) {
|
||||||
return [__("Variant"), "green", "variant_of,=," + doc.variant_of]
|
return [__("Template"), "blue", "has_variants,=,Yes"];
|
||||||
|
} else if (doc.variant_of) {
|
||||||
|
return [__("Variant"), "green", "variant_of,=," + doc.variant_of];
|
||||||
} else {
|
} else {
|
||||||
return [__("Active"), "blue", "end_of_life,>=,Today"]
|
return [__("Active"), "blue", "end_of_life,>=,Today"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import frappe.defaults
|
import frappe.defaults
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cstr, cint, flt, comma_or, getdate
|
from frappe.utils import cstr, cint, flt, comma_or, getdate, nowdate
|
||||||
from erpnext.stock.utils import get_incoming_rate
|
from erpnext.stock.utils import get_incoming_rate
|
||||||
from erpnext.stock.stock_ledger import get_previous_sle, NegativeStockError
|
from erpnext.stock.stock_ledger import get_previous_sle, NegativeStockError
|
||||||
from erpnext.stock.get_item_details import get_available_qty, get_default_cost_center, get_conversion_factor
|
from erpnext.stock.get_item_details import get_available_qty, get_default_cost_center, get_conversion_factor
|
||||||
@ -359,7 +359,7 @@ class StockEntry(StockController):
|
|||||||
|
|
||||||
def update_stock_ledger(self):
|
def update_stock_ledger(self):
|
||||||
sl_entries = []
|
sl_entries = []
|
||||||
|
|
||||||
# make sl entries for source warehouse first, then do for target warehouse
|
# make sl entries for source warehouse first, then do for target warehouse
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
if cstr(d.s_warehouse):
|
if cstr(d.s_warehouse):
|
||||||
@ -368,7 +368,7 @@ class StockEntry(StockController):
|
|||||||
"actual_qty": -flt(d.transfer_qty),
|
"actual_qty": -flt(d.transfer_qty),
|
||||||
"incoming_rate": 0
|
"incoming_rate": 0
|
||||||
}))
|
}))
|
||||||
|
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
if cstr(d.t_warehouse):
|
if cstr(d.t_warehouse):
|
||||||
sl_entries.append(self.get_sl_entries(d, {
|
sl_entries.append(self.get_sl_entries(d, {
|
||||||
@ -438,8 +438,10 @@ class StockEntry(StockController):
|
|||||||
def get_item_details(self, args=None, for_update=False):
|
def get_item_details(self, args=None, for_update=False):
|
||||||
item = frappe.db.sql("""select stock_uom, description, image, item_name,
|
item = frappe.db.sql("""select stock_uom, description, image, item_name,
|
||||||
expense_account, buying_cost_center, item_group from `tabItem`
|
expense_account, buying_cost_center, item_group from `tabItem`
|
||||||
where name = %s and (ifnull(end_of_life,'0000-00-00')='0000-00-00' or end_of_life > now())""",
|
where name = %s
|
||||||
(args.get('item_code')), as_dict = 1)
|
and disabled=0
|
||||||
|
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %s)""",
|
||||||
|
(args.get('item_code'), nowdate()), as_dict = 1)
|
||||||
if not item:
|
if not item:
|
||||||
frappe.throw(_("Item {0} is not active or end of life has been reached").format(args.get("item_code")))
|
frappe.throw(_("Item {0} is not active or end of life has been reached").format(args.get("item_code")))
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class StockReconciliation(StockController):
|
|||||||
item = frappe.get_doc("Item", item_code)
|
item = frappe.get_doc("Item", item_code)
|
||||||
|
|
||||||
# end of life and stock item
|
# end of life and stock item
|
||||||
validate_end_of_life(item_code, item.end_of_life, verbose=0)
|
validate_end_of_life(item_code, item.end_of_life, item.disabled, verbose=0)
|
||||||
validate_is_stock_item(item_code, item.is_stock_item, verbose=0)
|
validate_is_stock_item(item_code, item.is_stock_item, verbose=0)
|
||||||
|
|
||||||
# item should not be serialized
|
# item should not be serialized
|
||||||
|
@ -113,7 +113,7 @@ def validate_item_details(args, item):
|
|||||||
throw(_("Please specify Company"))
|
throw(_("Please specify Company"))
|
||||||
|
|
||||||
from erpnext.stock.doctype.item.item import validate_end_of_life
|
from erpnext.stock.doctype.item.item import validate_end_of_life
|
||||||
validate_end_of_life(item.name, item.end_of_life)
|
validate_end_of_life(item.name, item.end_of_life, item.disabled)
|
||||||
|
|
||||||
if args.transaction_type == "selling":
|
if args.transaction_type == "selling":
|
||||||
# validate if sales item or service item
|
# validate if sales item or service item
|
||||||
|
@ -23,6 +23,7 @@ def _reorder_item():
|
|||||||
items_to_consider = frappe.db.sql_list("""select name from `tabItem` item
|
items_to_consider = frappe.db.sql_list("""select name from `tabItem` item
|
||||||
where is_stock_item=1 and has_variants=0
|
where is_stock_item=1 and has_variants=0
|
||||||
and (is_purchase_item=1 or is_sub_contracted_item=1)
|
and (is_purchase_item=1 or is_sub_contracted_item=1)
|
||||||
|
and disabled=0
|
||||||
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s)
|
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s)
|
||||||
and ((re_order_level is not null and re_order_level > 0)
|
and ((re_order_level is not null and re_order_level > 0)
|
||||||
or exists (select name from `tabItem Reorder` ir where ir.parent=item.name)
|
or exists (select name from `tabItem Reorder` ir where ir.parent=item.name)
|
||||||
|
@ -79,6 +79,7 @@ def get_item_map(item_code):
|
|||||||
|
|
||||||
items = frappe.db.sql("""select * from `tabItem` item
|
items = frappe.db.sql("""select * from `tabItem` item
|
||||||
where is_stock_item = 1
|
where is_stock_item = 1
|
||||||
|
and disabled=0
|
||||||
{condition}
|
{condition}
|
||||||
and (end_of_life > %(today)s or end_of_life is null or end_of_life='0000-00-00')
|
and (end_of_life > %(today)s or end_of_life is null or end_of_life='0000-00-00')
|
||||||
and exists (select name from `tabBin` bin where bin.item_code=item.name)"""\
|
and exists (select name from `tabBin` bin where bin.item_code=item.name)"""\
|
||||||
|
@ -16,6 +16,7 @@ def get_product_list(search=None, start=0, limit=10):
|
|||||||
web_long_description as website_description, parent_website_route
|
web_long_description as website_description, parent_website_route
|
||||||
from `tabItem`
|
from `tabItem`
|
||||||
where show_in_website = 1
|
where show_in_website = 1
|
||||||
|
and disabled=0
|
||||||
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s)
|
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %(today)s)
|
||||||
and (variant_of is null or variant_of = '')"""
|
and (variant_of is null or variant_of = '')"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user