[cleanup] yes/no selects changed to checks in Item
This commit is contained in:
parent
18e033514e
commit
1e8025b327
@ -152,7 +152,7 @@ cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(do
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
filters:{
|
||||
'is_purchase_item': 'Yes'
|
||||
'is_purchase_item': 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,4 +232,3 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
|
||||
else
|
||||
cur_frm.pformat.print_heading = __("Purchase Invoice");
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ class PurchaseInvoice(BuyingController):
|
||||
def check_active_purchase_items(self):
|
||||
for d in self.get('items'):
|
||||
if d.item_code: # extra condn coz item_code is not mandatory in PV
|
||||
if frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 'Yes':
|
||||
if frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 1:
|
||||
msgprint(_("Item {0} is not Purchase Item").format(d.item_code), raise_exception=True)
|
||||
|
||||
def check_conversion_rate(self):
|
||||
|
@ -11,9 +11,9 @@ def get_items(price_list, sales_or_purchase, item=None):
|
||||
args = {"price_list": price_list}
|
||||
|
||||
if sales_or_purchase == "Sales":
|
||||
condition = "i.is_sales_item='Yes'"
|
||||
condition = "i.is_sales_item=1"
|
||||
else:
|
||||
condition = "i.is_purchase_item='Yes'"
|
||||
condition = "i.is_purchase_item=1"
|
||||
|
||||
if item:
|
||||
# search serial no
|
||||
|
@ -248,12 +248,10 @@ class SalesInvoice(SellingController):
|
||||
def validate_fixed_asset_account(self):
|
||||
"""Validate Fixed Asset and whether Income Account Entered Exists"""
|
||||
for d in self.get('items'):
|
||||
item = frappe.db.sql("""select name,is_asset_item,is_sales_item from `tabItem`
|
||||
where name = %s""", d.item_code)
|
||||
acc = frappe.db.sql("""select account_type from `tabAccount`
|
||||
where name = %s and docstatus != 2""", d.income_account)
|
||||
if item and item[0][1] == 'Yes' and acc and acc[0][0] != 'Fixed Asset':
|
||||
msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(acc[0][0], d.item_code), raise_exception=True)
|
||||
is_asset_item = frappe.db.get_value("Item", d.item_code, "is_asset_item")
|
||||
account_type = frappe.db.get_value("Account", d.income_account, "account_type")
|
||||
if is_asset_item == 1 and account_type != 'Fixed Asset':
|
||||
msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(d.income_account, d.item_code), raise_exception=True)
|
||||
|
||||
def validate_with_previous_doc(self):
|
||||
super(SalesInvoice, self).validate_with_previous_doc({
|
||||
@ -296,7 +294,7 @@ class SalesInvoice(SellingController):
|
||||
for i in dic:
|
||||
if frappe.db.get_value('Selling Settings', None, dic[i]) == 'Yes':
|
||||
for d in self.get('items'):
|
||||
if frappe.db.get_value('Item', d.item_code, 'is_stock_item') == 'Yes' \
|
||||
if frappe.db.get_value('Item', d.item_code, 'is_stock_item') == 1 \
|
||||
and not d.get(i.lower().replace(' ','_')):
|
||||
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
|
||||
|
||||
@ -426,10 +424,12 @@ class SalesInvoice(SellingController):
|
||||
def update_stock_ledger(self):
|
||||
sl_entries = []
|
||||
for d in self.get_item_list():
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == "Yes" and d.warehouse:
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \
|
||||
and d.warehouse:
|
||||
incoming_rate = 0
|
||||
if cint(self.is_return) and self.return_against and self.docstatus==1:
|
||||
incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code, self.return_against)
|
||||
incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code,
|
||||
self.return_against)
|
||||
|
||||
sl_entries.append(self.get_sl_entries(d, {
|
||||
"actual_qty": -1*flt(d.qty),
|
||||
|
@ -257,4 +257,4 @@ class GrossProfitGenerator(object):
|
||||
|
||||
def load_non_stock_items(self):
|
||||
self.non_stock_items = frappe.db.sql_list("""select name from tabItem
|
||||
where ifnull(is_stock_item, 'No')='No'""")
|
||||
where is_stock_item=0""")
|
||||
|
@ -44,12 +44,12 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
if(me.frm.doc.is_subcontracted == "Yes") {
|
||||
return{
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
filters:{ 'is_sub_contracted_item': 'Yes' }
|
||||
filters:{ 'is_sub_contracted_item': 1 }
|
||||
}
|
||||
} else {
|
||||
return{
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
filters: { 'is_purchase_item': 'Yes' }
|
||||
filters: { 'is_purchase_item': 1 }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -56,18 +56,19 @@ class PurchaseCommon(BuyingController):
|
||||
d.set(x, f_lst[x])
|
||||
|
||||
item = frappe.db.sql("""select is_stock_item, is_purchase_item,
|
||||
is_sub_contracted_item, end_of_life from `tabItem` where name=%s""", d.item_code)
|
||||
is_sub_contracted_item, end_of_life from `tabItem` where name=%s""",
|
||||
d.item_code, as_dict=1)[0]
|
||||
|
||||
from erpnext.stock.doctype.item.item import validate_end_of_life
|
||||
validate_end_of_life(d.item_code, item[0][3])
|
||||
validate_end_of_life(d.item_code, item.end_of_life)
|
||||
|
||||
# validate stock item
|
||||
if item[0][0]=='Yes' and d.qty and not d.warehouse:
|
||||
if item.is_stock_item==1 and d.qty and not d.warehouse:
|
||||
frappe.throw(_("Warehouse is mandatory for stock Item {0} in row {1}").format(d.item_code, d.idx))
|
||||
|
||||
# validate purchase item
|
||||
if not (obj.doctype=="Material Request" and getattr(obj, "material_request_type", None)=="Material Transfer"):
|
||||
if item[0][1] != 'Yes' and item[0][2] != 'Yes':
|
||||
if item.is_purchase_item != 1 and item.is_sub_contracted_item != 1:
|
||||
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))
|
||||
|
@ -153,7 +153,7 @@ class PurchaseOrder(BuyingController):
|
||||
item_wh_list = []
|
||||
for d in self.get("items"):
|
||||
if (not po_item_rows or d.name in po_item_rows) and [d.item_code, d.warehouse] not in item_wh_list \
|
||||
and frappe.db.get_value("Item", d.item_code, "is_stock_item") == "Yes" and d.warehouse:
|
||||
and frappe.db.get_value("Item", d.item_code, "is_stock_item") and d.warehouse:
|
||||
item_wh_list.append([d.item_code, d.warehouse])
|
||||
|
||||
for item_code, warehouse in item_wh_list:
|
||||
|
2
erpnext/change_log/current/item_cleanup.md
Normal file
2
erpnext/change_log/current/item_cleanup.md
Normal file
@ -0,0 +1,2 @@
|
||||
- **Item** form cleanups: "Yes" / "No" type fields changed to checkboxes.<br>
|
||||
**Warning**: This could break your 3rd party integrations with Item, if any.
|
@ -307,7 +307,7 @@ class AccountsController(TransactionBase):
|
||||
item_codes = list(set(item.item_code for item in self.get("items")))
|
||||
if item_codes:
|
||||
stock_items = [r[0] for r in frappe.db.sql("""select name
|
||||
from `tabItem` where name in (%s) and is_stock_item='Yes'""" % \
|
||||
from `tabItem` where name in (%s) and is_stock_item=1""" % \
|
||||
(", ".join((["%s"]*len(item_codes))),), item_codes)]
|
||||
|
||||
return stock_items
|
||||
|
@ -239,7 +239,7 @@ class BuyingController(StockController):
|
||||
from `tabBOM` t1, `tabBOM Item` t2, tabItem t3
|
||||
where t2.parent = t1.name and t1.item = %s
|
||||
and t1.docstatus = 1 and t1.is_active = 1 and t1.name = %s
|
||||
and t2.item_code = t3.name and ifnull(t3.is_stock_item, 'No') = 'Yes'""", (item_code, bom), as_dict=1)
|
||||
and t2.item_code = t3.name and t3.is_stock_item = 1""", (item_code, bom), as_dict=1)
|
||||
|
||||
if not bom_items:
|
||||
msgprint(_("Specified BOM {0} does not exist for Item {1}").format(bom, item_code), raise_exception=1)
|
||||
@ -254,7 +254,7 @@ class BuyingController(StockController):
|
||||
self.get("items")))
|
||||
if item_codes:
|
||||
self._sub_contracted_items = [r[0] for r in frappe.db.sql("""select name
|
||||
from `tabItem` where name in (%s) and is_sub_contracted_item='Yes'""" % \
|
||||
from `tabItem` where name in (%s) and is_sub_contracted_item=1""" % \
|
||||
(", ".join((["%s"]*len(item_codes))),), item_codes)]
|
||||
|
||||
return self._sub_contracted_items
|
||||
|
@ -248,7 +248,7 @@ def check_active_sales_items(obj):
|
||||
item = frappe.db.sql("""select docstatus, is_sales_item,
|
||||
is_service_item, income_account from tabItem where name = %s""",
|
||||
d.item_code, as_dict=True)[0]
|
||||
if item.is_sales_item == 'No' and item.is_service_item == 'No':
|
||||
if item.is_sales_item == 0 and item.is_service_item == 0:
|
||||
frappe.throw(_("Item {0} must be Sales or Service Item in {1}").format(d.item_code, d.idx))
|
||||
if getattr(d, "income_account", None) and not item.income_account:
|
||||
frappe.db.set_value("Item", d.item_code, "income_account",
|
||||
|
@ -212,7 +212,7 @@ class StockController(AccountsController):
|
||||
item_codes = list(set([d.item_code for d in self.get("items")]))
|
||||
if item_codes:
|
||||
serialized_items = frappe.db.sql_list("""select name from `tabItem`
|
||||
where has_serial_no='Yes' and name in ({})""".format(", ".join(["%s"]*len(item_codes))),
|
||||
where has_serial_no=1 and name in ({})""".format(", ".join(["%s"]*len(item_codes))),
|
||||
tuple(item_codes))
|
||||
|
||||
return serialized_items
|
||||
|
@ -48,7 +48,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
filters: me.frm.doc.enquiry_type === "Maintenance" ?
|
||||
{"is_service_item": "Yes"} : {"is_sales_item": "Yes"}
|
||||
{"is_service_item": 1} : {"is_sales_item":1}
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -24,7 +24,7 @@ class HubSettings(Document):
|
||||
def publish_selling_items(self):
|
||||
"""Set `publish_in_hub`=1 for all Sales Items"""
|
||||
for item in frappe.get_all("Item", fields=["name"],
|
||||
filters={"is_sales_item": "Yes", "publish_in_hub": "0"}):
|
||||
filters={"is_sales_item": 1, "publish_in_hub": "0"}):
|
||||
frappe.db.set_value("Item", item.name, "publish_in_hub", 1)
|
||||
|
||||
def register(self):
|
||||
|
@ -107,7 +107,7 @@ class BOM(Document):
|
||||
rate = 0
|
||||
if arg['bom_no']:
|
||||
rate = self.get_bom_unitcost(arg['bom_no'])
|
||||
elif arg and (arg['is_purchase_item'] == 'Yes' or arg['is_sub_contracted_item'] == 'Yes'):
|
||||
elif arg and (arg['is_purchase_item'] == 1 or arg['is_sub_contracted_item'] == 1):
|
||||
if self.rm_cost_as_per == 'Valuation Rate':
|
||||
rate = self.get_valuation_rate(arg)
|
||||
elif self.rm_cost_as_per == 'Last Purchase Rate':
|
||||
@ -385,14 +385,14 @@ def get_bom_items_as_dict(bom, qty=1, fetch_exploded=1):
|
||||
and bom_item.docstatus < 2
|
||||
and bom_item.parent = %(bom)s
|
||||
and item.name = bom_item.item_code
|
||||
and ifnull(item.is_stock_item, 'No') = 'Yes'
|
||||
and is_stock_item = 1
|
||||
{conditions}
|
||||
group by item_code, stock_uom"""
|
||||
|
||||
if fetch_exploded:
|
||||
query = query.format(table="BOM Explosion Item",
|
||||
conditions="""and ifnull(item.is_pro_applicable, 'No') = 'No'
|
||||
and ifnull(item.is_sub_contracted_item, 'No') = 'No' """)
|
||||
conditions="""and item.is_pro_applicable = 0
|
||||
and item.is_sub_contracted_item = 0 """)
|
||||
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
|
||||
else:
|
||||
query = query.format(table="BOM Item", conditions="")
|
||||
|
@ -195,7 +195,6 @@ $.extend(cur_frm.cscript, {
|
||||
qty: function() {
|
||||
frappe.ui.form.trigger("Production Order", 'bom_no')
|
||||
},
|
||||
|
||||
show_time_logs: function(doc, cdt, cdn) {
|
||||
var child = locals[cdt][cdn]
|
||||
frappe.route_options = {"operation_id": child.name};
|
||||
@ -250,8 +249,8 @@ cur_frm.cscript['Update Finished Goods'] = function() {
|
||||
cur_frm.fields_dict['production_item'].get_query = function(doc) {
|
||||
return {
|
||||
filters:[
|
||||
['Item', 'is_pro_applicable', '=', 'Yes'],
|
||||
['Item', 'has_variants', '=', 'No'],
|
||||
['Item', 'is_pro_applicable', '=', 1],
|
||||
['Item', 'has_variants', '=', 0]
|
||||
['Item', 'end_of_life', '>=', frappe.datetime.nowdate()]
|
||||
]
|
||||
}
|
||||
@ -264,7 +263,3 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -322,7 +322,7 @@ class ProductionOrder(Document):
|
||||
frappe.delete_doc("Time Log", time_log.name)
|
||||
|
||||
def validate_production_item(self):
|
||||
if frappe.db.get_value("Item", self.production_item, "is_pro_applicable")=='No':
|
||||
if not frappe.db.get_value("Item", self.production_item, "is_pro_applicable"):
|
||||
frappe.throw(_("Item is not allowed to have Production Order."), ProductionNotApplicableError)
|
||||
|
||||
if frappe.db.get_value("Item", self.production_item, "has_variants"):
|
||||
|
@ -137,12 +137,12 @@ class TestProductionOrder(unittest.TestCase):
|
||||
self.assertEqual(prod_order.planned_operating_cost, cost*2)
|
||||
|
||||
def test_production_item(self):
|
||||
frappe.db.set_value("Item", "_Test FG Item", "is_pro_applicable", "No")
|
||||
frappe.db.set_value("Item", "_Test FG Item", "is_pro_applicable", 0)
|
||||
|
||||
prod_order = make_prod_order_test_record(item="_Test FG Item", qty=1, do_not_save=True)
|
||||
self.assertRaises(ProductionNotApplicableError, prod_order.save)
|
||||
|
||||
frappe.db.set_value("Item", "_Test FG Item", "is_pro_applicable", "Yes")
|
||||
frappe.db.set_value("Item", "_Test FG Item", "is_pro_applicable", 1)
|
||||
frappe.db.set_value("Item", "_Test FG Item", "end_of_life", "2000-1-1")
|
||||
|
||||
self.assertRaises(frappe.ValidationError, prod_order.save)
|
||||
|
@ -52,7 +52,7 @@ cur_frm.fields_dict['sales_orders'].grid.get_field('sales_order').get_query = fu
|
||||
|
||||
cur_frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc) {
|
||||
return erpnext.queries.item({
|
||||
'is_pro_applicable': 'Yes'
|
||||
'is_pro_applicable': 1
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,13 +61,13 @@ class ProductionPlanningTool(Document):
|
||||
and so.company = %s
|
||||
and ifnull(so_item.qty, 0) > ifnull(so_item.delivered_qty, 0) %s
|
||||
and (exists (select name from `tabItem` item where item.name=so_item.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes') %s)
|
||||
and (item.is_pro_applicable = 1
|
||||
or item.is_sub_contracted_item = 1 %s)
|
||||
or exists (select name from `tabPacked Item` pi
|
||||
where pi.parent = so.name and pi.parent_item = so_item.item_code
|
||||
and exists (select name from `tabItem` item where item.name=pi.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes') %s)))
|
||||
and (item.is_pro_applicable = 1
|
||||
or item.is_sub_contracted_item = 1) %s)))
|
||||
""" % ('%s', so_filter, item_filter, item_filter), self.company, as_dict=1)
|
||||
|
||||
self.add_so_in_table(open_so)
|
||||
@ -108,8 +108,8 @@ class ProductionPlanningTool(Document):
|
||||
from `tabSales Order Item` so_item
|
||||
where parent in (%s) and docstatus = 1 and ifnull(qty, 0) > ifnull(delivered_qty, 0)
|
||||
and exists (select * from `tabItem` item where item.name=so_item.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes')) %s""" % \
|
||||
and (item.is_pro_applicable = 1
|
||||
or item.is_sub_contracted_item = 1)) %s""" % \
|
||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||
|
||||
if self.fg_item:
|
||||
@ -123,8 +123,8 @@ class ProductionPlanningTool(Document):
|
||||
and pi.parent_item = so_item.item_code
|
||||
and so_item.parent in (%s) and ifnull(so_item.qty, 0) > ifnull(so_item.delivered_qty, 0)
|
||||
and exists (select * from `tabItem` item where item.name=pi.item_code
|
||||
and (ifnull(item.is_pro_applicable, 'No') = 'Yes'
|
||||
or ifnull(item.is_sub_contracted_item, 'No') = 'Yes')) %s""" % \
|
||||
and (item.is_pro_applicable = 1
|
||||
or item.is_sub_contracted_item = 1)) %s""" % \
|
||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||
|
||||
return items + packed_items
|
||||
@ -178,7 +178,7 @@ class ProductionPlanningTool(Document):
|
||||
for d in self.get("items"):
|
||||
if d.bom_no:
|
||||
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
|
||||
if frappe.db.get_value("Item", d.item_code, "is_pro_applicable") == "Yes":
|
||||
if frappe.db.get_value("Item", d.item_code, "is_pro_applicable"):
|
||||
item_dict[(d.item_code, d.sales_order, d.warehouse)] = {
|
||||
"production_item" : d.item_code,
|
||||
"sales_order" : d.sales_order,
|
||||
@ -240,9 +240,9 @@ class ProductionPlanningTool(Document):
|
||||
fb.description, fb.stock_uom, it.min_order_qty
|
||||
from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` it
|
||||
where bom.name = fb.parent and it.name = fb.item_code
|
||||
and ifnull(it.is_pro_applicable, 'No') = 'No'
|
||||
and ifnull(it.is_sub_contracted_item, 'No') = 'No'
|
||||
and ifnull(it.is_stock_item, 'No') = 'Yes'
|
||||
and is_pro_applicable = 0
|
||||
and is_sub_contracted_item = 0
|
||||
and is_stock_item = 1
|
||||
and fb.docstatus<2 and bom.name=%s
|
||||
group by item_code, stock_uom""", bom, as_dict=1):
|
||||
bom_wise_item_details.setdefault(d.item_code, d)
|
||||
@ -255,7 +255,7 @@ class ProductionPlanningTool(Document):
|
||||
from `tabBOM Item` bom_item, `tabBOM` bom, tabItem item
|
||||
where bom.name = bom_item.parent and bom.name = %s and bom_item.docstatus < 2
|
||||
and bom_item.item_code = item.name
|
||||
and ifnull(item.is_stock_item, 'No') = 'Yes'
|
||||
and item.is_stock_item = 1
|
||||
group by item_code""", bom, as_dict=1):
|
||||
bom_wise_item_details.setdefault(d.item_code, d)
|
||||
|
||||
|
@ -24,6 +24,9 @@ erpnext.patches.v4_0.map_charge_to_taxes_and_charges
|
||||
execute:frappe.reload_doc('support', 'doctype', 'newsletter') # 2014-01-31
|
||||
execute:frappe.reload_doc('hr', 'doctype', 'employee') # 2014-02-03
|
||||
execute:frappe.db.sql("update tabPage set module='Core' where name='Setup'")
|
||||
|
||||
# inserted this patch here since Item types are being changed
|
||||
erpnext.patches.v5_2.change_item_selects_to_checks
|
||||
erpnext.patches.v4_0.fields_to_be_renamed
|
||||
erpnext.patches.v4_0.rename_sitemap_to_route
|
||||
erpnext.patches.v4_0.fix_contact_address
|
||||
|
@ -5,11 +5,11 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("update tabItem set has_batch_no = 'No' where ifnull(has_batch_no, '') = ''")
|
||||
frappe.db.sql("update tabItem set has_serial_no = 'No' where ifnull(has_serial_no, '') = ''")
|
||||
frappe.db.sql("update tabItem set has_batch_no = 0 where ifnull(has_batch_no, '') = ''")
|
||||
frappe.db.sql("update tabItem set has_serial_no = 0 where ifnull(has_serial_no, '') = ''")
|
||||
|
||||
item_list = frappe.db.sql("""select name, has_batch_no, has_serial_no from tabItem
|
||||
where ifnull(is_stock_item, 'No') = 'Yes'""", as_dict=1)
|
||||
where is_stock_item = 1""", as_dict=1)
|
||||
|
||||
sle_count = get_sle_count()
|
||||
sle_with_batch = get_sle_with_batch()
|
||||
@ -19,19 +19,19 @@ def execute():
|
||||
serialized_items = get_items_with_serial()
|
||||
|
||||
for d in item_list:
|
||||
if d.has_batch_no == 'Yes':
|
||||
if d.has_batch_no == 1:
|
||||
if d.name not in batch_items and sle_count.get(d.name) and sle_count.get(d.name) != sle_with_batch.get(d.name):
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", "No")
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", 0)
|
||||
else:
|
||||
if d.name in batch_items or (sle_count.get(d.name) and sle_count.get(d.name) == sle_with_batch.get(d.name)):
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", "Yes")
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", 1)
|
||||
|
||||
if d.has_serial_no == 'Yes':
|
||||
if d.has_serial_no == 1:
|
||||
if d.name not in serialized_items and sle_count.get(d.name) and sle_count.get(d.name) != sle_with_serial.get(d.name):
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", "No")
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", 0)
|
||||
else:
|
||||
if d.name in serialized_items or (sle_count.get(d.name) and sle_count.get(d.name) == sle_with_serial.get(d.name)):
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", "Yes")
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", 1)
|
||||
|
||||
|
||||
def get_sle_count():
|
||||
|
1
erpnext/patches/v5_2/__init__.py
Normal file
1
erpnext/patches/v5_2/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
21
erpnext/patches/v5_2/change_item_selects_to_checks.py
Normal file
21
erpnext/patches/v5_2/change_item_selects_to_checks.py
Normal file
@ -0,0 +1,21 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
fields = ("is_stock_item", "is_asset_item", "has_batch_no", "has_serial_no",
|
||||
"is_purchase_item", "is_sales_item", "is_service_item", "inspection_required",
|
||||
"is_pro_applicable", "is_sub_contracted_item")
|
||||
|
||||
|
||||
# convert to 1 or 0
|
||||
update_str = ", ".join(["`{0}`=if(`{0}`='Yes',1,0)".format(f) for f in fields])
|
||||
frappe.db.sql("update tabItem set {0}".format(update_str))
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
# alter fields to int
|
||||
for f in fields:
|
||||
frappe.db.sql("alter table tabItem change {0} {0} int(1) default '0'".format(f, f))
|
||||
|
||||
frappe.reload_doctype("Item")
|
@ -39,10 +39,10 @@ class InstallationNote(TransactionBase):
|
||||
check_active_sales_items(self)
|
||||
|
||||
def is_serial_no_added(self, item_code, serial_no):
|
||||
ar_required = frappe.db.get_value("Item", item_code, "has_serial_no")
|
||||
if ar_required == 'Yes' and not serial_no:
|
||||
has_serial_no = frappe.db.get_value("Item", item_code, "has_serial_no")
|
||||
if has_serial_no == 1 and not serial_no:
|
||||
frappe.throw(_("Serial No is mandatory for Item {0}").format(item_code))
|
||||
elif ar_required != 'Yes' and cstr(serial_no).strip():
|
||||
elif has_serial_no != 1 and cstr(serial_no).strip():
|
||||
frappe.throw(_("Item {0} is not a serialized Item").format(item_code))
|
||||
|
||||
def is_serial_no_exist(self, item_code, serial_no):
|
||||
@ -69,7 +69,7 @@ class InstallationNote(TransactionBase):
|
||||
frappe.throw(_("Serial No {0} does not belong to Delivery Note {1}").format(sr, prevdoc_docname))
|
||||
|
||||
def validate_serial_no(self):
|
||||
cur_s_no, prevdoc_s_no, sr_list = [], [], []
|
||||
prevdoc_s_no, sr_list = [], []
|
||||
for d in self.get('items'):
|
||||
self.is_serial_no_added(d.item_code, d.serial_no)
|
||||
if d.serial_no:
|
||||
|
@ -21,7 +21,7 @@ class ProductBundle(Document):
|
||||
def validate_main_item(self):
|
||||
"""main item must have Is Stock Item as No and Is Sales Item as Yes"""
|
||||
if not frappe.db.sql("""select name from tabItem where name=%s and
|
||||
ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'""", self.new_item_code):
|
||||
is_stock_item = 0 and is_sales_item = 1""", self.new_item_code):
|
||||
frappe.throw(_("Parent Item {0} must be not Stock Item and must be a Sales Item").format(self.new_item_code))
|
||||
|
||||
def get_item_details(self, name):
|
||||
@ -36,7 +36,7 @@ def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
|
||||
from erpnext.controllers.queries import get_match_cond
|
||||
|
||||
return frappe.db.sql("""select name, item_name, description from tabItem
|
||||
where is_stock_item="No" and is_sales_item="Yes"
|
||||
where is_stock_item=0 and is_sales_item=1
|
||||
and name not in (select name from `tabProduct Bundle`) and %s like %s
|
||||
%s limit %s, %s""" % (searchfield, "%s",
|
||||
get_match_cond(doctype),"%s", "%s"),
|
||||
|
@ -28,17 +28,11 @@ class Quotation(SellingController):
|
||||
|
||||
if self.order_type in ['Maintenance', 'Service']:
|
||||
for d in self.get('items'):
|
||||
is_service_item = frappe.db.sql("select is_service_item from `tabItem` where name=%s", d.item_code)
|
||||
is_service_item = is_service_item and is_service_item[0][0] or 'No'
|
||||
|
||||
if is_service_item == 'No':
|
||||
if not frappe.db.get_value("Item", d.item_code, "is_service_item"):
|
||||
frappe.throw(_("Item {0} must be Service Item").format(d.item_code))
|
||||
else:
|
||||
for d in self.get('items'):
|
||||
is_sales_item = frappe.db.sql("select is_sales_item from `tabItem` where name=%s", d.item_code)
|
||||
is_sales_item = is_sales_item and is_sales_item[0][0] or 'No'
|
||||
|
||||
if is_sales_item == 'No':
|
||||
if not frappe.db.get_value("Item", d.item_code, "is_sales_item"):
|
||||
frappe.throw(_("Item {0} must be Sales Item").format(d.item_code))
|
||||
|
||||
def validate_quotation_to(self):
|
||||
|
@ -39,7 +39,7 @@ class SalesOrder(SellingController):
|
||||
for d in self.get('items'):
|
||||
check_list.append(cstr(d.item_code))
|
||||
|
||||
if (frappe.db.get_value("Item", d.item_code, "is_stock_item") == 'Yes' or
|
||||
if (frappe.db.get_value("Item", d.item_code, "is_stock_item")==1 or
|
||||
self.has_product_bundle(d.item_code)) and not d.warehouse:
|
||||
frappe.throw(_("Reserved warehouse required for stock item {0}").format(d.item_code))
|
||||
|
||||
@ -217,7 +217,7 @@ class SalesOrder(SellingController):
|
||||
def update_stock_ledger(self, update_stock):
|
||||
from erpnext.stock.utils import update_bin
|
||||
for d in self.get_item_list():
|
||||
if frappe.db.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
|
||||
if frappe.db.get_value("Item", d['item_code'], "is_stock_item")==1:
|
||||
args = {
|
||||
"item_code": d['item_code'],
|
||||
"warehouse": d['reserved_warehouse'],
|
||||
|
@ -57,8 +57,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
filters: (me.frm.doc.order_type === "Maintenance" ?
|
||||
{'is_service_item': 'Yes'}:
|
||||
{'is_sales_item': 'Yes' })
|
||||
{'is_service_item': 1}:
|
||||
{'is_sales_item': 1 })
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ def make_sample_data():
|
||||
"""Create a few opportunities, quotes, material requests, issues, todos, projects
|
||||
to help the user get started"""
|
||||
|
||||
selling_items = frappe.get_all("Item", filters = {"is_sales_item": "Yes"})
|
||||
buying_items = frappe.get_all("Item", filters = {"is_sales_item": "No"})
|
||||
selling_items = frappe.get_all("Item", filters = {"is_sales_item": 1})
|
||||
buying_items = frappe.get_all("Item", filters = {"is_sales_item": 0})
|
||||
|
||||
if selling_items:
|
||||
for i in range(3):
|
||||
@ -37,7 +37,7 @@ def make_opportunity(selling_items):
|
||||
|
||||
add_random_children(b, "items", rows=len(selling_items), randomize = {
|
||||
"qty": (1, 5),
|
||||
"item_code": ("Item", {"is_sales_item": "Yes"})
|
||||
"item_code": ("Item", {"is_sales_item": 1})
|
||||
}, unique="item_code")
|
||||
|
||||
b.insert(ignore_permissions=True)
|
||||
@ -54,7 +54,7 @@ def make_quote(selling_items):
|
||||
|
||||
add_random_children(qtn, "items", rows=len(selling_items), randomize = {
|
||||
"qty": (1, 5),
|
||||
"item_code": ("Item", {"is_sales_item": "Yes"})
|
||||
"item_code": ("Item", {"is_sales_item": 1})
|
||||
}, unique="item_code")
|
||||
|
||||
qtn.insert(ignore_permissions=True)
|
||||
|
@ -368,10 +368,10 @@ def create_items(args):
|
||||
"item_code": item,
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"is_sales_item": "Yes" if is_sales_item else "No",
|
||||
"is_purchase_item": "Yes" if is_purchase_item else "No",
|
||||
"is_sales_item": 1 if is_sales_item else 0,
|
||||
"is_purchase_item": 1 if is_purchase_item else 0,
|
||||
"show_in_website": 1,
|
||||
"is_stock_item": is_stock_item and "Yes" or "No",
|
||||
"is_stock_item": is_stock_item and 1 or 0,
|
||||
"item_group": item_group,
|
||||
"stock_uom": args.get("item_uom_" + str(i)),
|
||||
"default_warehouse": default_warehouse
|
||||
|
@ -5,8 +5,8 @@ cur_frm.fields_dict['item'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
filters:{
|
||||
'is_stock_item': 'Yes',
|
||||
'has_batch_no': 'Yes'
|
||||
'is_stock_item': 1,
|
||||
'has_batch_no': 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ class Batch(Document):
|
||||
self.item_has_batch_enabled()
|
||||
|
||||
def item_has_batch_enabled(self):
|
||||
if frappe.db.get_value("Item",self.item,"has_batch_no") =='No':
|
||||
if frappe.db.get_value("Item",self.item,"has_batch_no") == 0:
|
||||
frappe.throw(_("The selected item cannot have Batch"))
|
||||
|
@ -138,7 +138,7 @@ class DeliveryNote(SellingController):
|
||||
e = [d.item_code, d.description, d.warehouse, d.against_sales_order or d.against_sales_invoice, d.batch_no or '']
|
||||
f = [d.item_code, d.description, d.against_sales_order or d.against_sales_invoice]
|
||||
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 'Yes':
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1:
|
||||
if e in check_list:
|
||||
msgprint(_("Note: Item {0} entered multiple times").format(d.item_code))
|
||||
else:
|
||||
@ -151,7 +151,7 @@ class DeliveryNote(SellingController):
|
||||
|
||||
def validate_warehouse(self):
|
||||
for d in self.get_item_list():
|
||||
if frappe.db.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
|
||||
if frappe.db.get_value("Item", d['item_code'], "is_stock_item") == 1:
|
||||
if not d['warehouse']:
|
||||
frappe.throw(_("Warehouse required for stock Item {0}").format(d["item_code"]))
|
||||
|
||||
@ -247,7 +247,7 @@ class DeliveryNote(SellingController):
|
||||
def update_stock_ledger(self):
|
||||
sl_entries = []
|
||||
for d in self.get_item_list():
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == "Yes" \
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \
|
||||
and d.warehouse and flt(d['qty']):
|
||||
self.update_reserved_qty(d)
|
||||
|
||||
|
@ -43,7 +43,7 @@ frappe.ui.form.on("Item", {
|
||||
|
||||
erpnext.item.edit_prices_button(frm);
|
||||
|
||||
if (!frm.doc.__islocal && frm.doc.is_stock_item == 'Yes') {
|
||||
if (!frm.doc.__islocal && frm.doc.is_stock_item) {
|
||||
frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method', 'has_batch_no'],
|
||||
(frm.doc.__onload && frm.doc.__onload.sle_exists=="exists") ? false : true);
|
||||
}
|
||||
@ -168,7 +168,7 @@ $.extend(erpnext.item, {
|
||||
},
|
||||
|
||||
toggle_reqd: function(frm) {
|
||||
frm.toggle_reqd("default_warehouse", frm.doc.is_stock_item==="Yes");
|
||||
frm.toggle_reqd("default_warehouse", frm.doc.is_stock_item);
|
||||
},
|
||||
|
||||
make_dashboard: function(frm) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "Item will be saved by this name in the data base.",
|
||||
"description": "",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 0,
|
||||
@ -80,7 +80,7 @@
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"description": "Unit of measurement of this item (e.g. Kg, Unit, No, Pair).",
|
||||
"description": "",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
@ -113,17 +113,6 @@
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "2099-12-31",
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"fieldname": "end_of_life",
|
||||
"fieldtype": "Date",
|
||||
"label": "End of Life",
|
||||
"oldfieldname": "end_of_life",
|
||||
"oldfieldtype": "Date",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
@ -166,11 +155,233 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "inventory",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Inventory",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-truck",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "",
|
||||
"fieldname": "is_stock_item",
|
||||
"fieldtype": "Check",
|
||||
"label": "Maintain Stock",
|
||||
"oldfieldname": "is_stock_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "",
|
||||
"depends_on": "eval:doc.is_stock_item",
|
||||
"fieldname": "has_batch_no",
|
||||
"fieldtype": "Check",
|
||||
"label": "Has Batch No",
|
||||
"oldfieldname": "has_batch_no",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "",
|
||||
"depends_on": "eval:doc.is_stock_item",
|
||||
"description": "Selecting \"Yes\" will give a unique identity to each entity of this item which can be viewed in the Serial No master.",
|
||||
"fieldname": "has_serial_no",
|
||||
"fieldtype": "Check",
|
||||
"in_filter": 1,
|
||||
"label": "Has Serial No",
|
||||
"oldfieldname": "has_serial_no",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "has_serial_no",
|
||||
"description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.",
|
||||
"fieldname": "serial_no_series",
|
||||
"fieldtype": "Data",
|
||||
"label": "Serial Number Series",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"default": "",
|
||||
"depends_on": "eval:doc.is_stock_item",
|
||||
"description": "",
|
||||
"fieldname": "is_asset_item",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Fixed Asset Item",
|
||||
"oldfieldname": "is_asset_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "is_stock_item",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"depends_on": "",
|
||||
"description": "",
|
||||
"fieldname": "default_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Warehouse",
|
||||
"oldfieldname": "default_warehouse",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "is_stock_item",
|
||||
"description": "",
|
||||
"fieldname": "tolerance",
|
||||
"fieldtype": "Float",
|
||||
"label": "Allow over delivery or receipt upto this percent",
|
||||
"oldfieldname": "tolerance",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "is_stock_item",
|
||||
"fieldname": "valuation_method",
|
||||
"fieldtype": "Select",
|
||||
"label": "Valuation Method",
|
||||
"options": "\nFIFO\nMoving Average",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "0.00",
|
||||
"depends_on": "is_stock_item",
|
||||
"description": "",
|
||||
"fieldname": "min_order_qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"label": "Minimum Order Qty",
|
||||
"oldfieldname": "min_order_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item",
|
||||
"fieldname": "warranty_period",
|
||||
"fieldtype": "Data",
|
||||
"label": "Warranty Period (in days)",
|
||||
"oldfieldname": "warranty_period",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "2099-12-31",
|
||||
"depends_on": "is_stock_item",
|
||||
"fieldname": "end_of_life",
|
||||
"fieldtype": "Date",
|
||||
"label": "End of Life",
|
||||
"oldfieldname": "end_of_life",
|
||||
"oldfieldtype": "Date",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "is_stock_item",
|
||||
"description": "",
|
||||
"fieldname": "net_weight",
|
||||
"fieldtype": "Float",
|
||||
"label": "Net Weight",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item",
|
||||
"fieldname": "weight_uom",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Weight UOM",
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item",
|
||||
"description": "",
|
||||
"fieldname": "reorder_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Auto re-order",
|
||||
"options": "icon-rss",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item && !doc.apply_warehouse_wise_reorder_level)",
|
||||
"description": "Automatically create Material Request if quantity falls below this level",
|
||||
"fieldname": "re_order_level",
|
||||
"fieldtype": "Float",
|
||||
"label": "Re-order Level",
|
||||
"oldfieldname": "re_order_level",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item && !doc.apply_warehouse_wise_reorder_level)",
|
||||
"fieldname": "re_order_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Re-order Qty",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "is_stock_item",
|
||||
"fieldname": "apply_warehouse_wise_reorder_level",
|
||||
"fieldtype": "Check",
|
||||
"label": "Apply Warehouse-wise Reorder Level",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item && doc.apply_warehouse_wise_reorder_level)",
|
||||
"fieldname": "section_break_31",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item && doc.apply_warehouse_wise_reorder_level)",
|
||||
"description": "Will also apply for variants unless overrridden",
|
||||
"fieldname": "reorder_levels",
|
||||
"fieldtype": "Table",
|
||||
"label": "Warehouse-wise Reorder Levels",
|
||||
"options": "Item Reorder",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.variant_of",
|
||||
"fieldname": "variants_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Variant",
|
||||
"label": "Variants",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
@ -219,253 +430,34 @@
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "inventory",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Inventory",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-truck",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "Yes",
|
||||
"description": "Select \"Yes\" if you are maintaining stock of this item in your Inventory.",
|
||||
"fieldname": "is_stock_item",
|
||||
"fieldtype": "Select",
|
||||
"label": "Is Stock Item",
|
||||
"oldfieldname": "is_stock_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "",
|
||||
"description": "Mandatory if Stock Item is \"Yes\". Also the default warehouse where reserved quantity is set from Sales Order.",
|
||||
"fieldname": "default_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Warehouse",
|
||||
"oldfieldname": "default_warehouse",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"description": "Percentage variation in quantity to be allowed while receiving or delivering this item.",
|
||||
"fieldname": "tolerance",
|
||||
"fieldtype": "Float",
|
||||
"label": "Allowance Percent",
|
||||
"oldfieldname": "tolerance",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"fieldname": "valuation_method",
|
||||
"fieldtype": "Select",
|
||||
"label": "Valuation Method",
|
||||
"options": "\nFIFO\nMoving Average",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "0.00",
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"description": "You can enter the minimum quantity of this item to be ordered.",
|
||||
"fieldname": "min_order_qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"label": "Minimum Order Qty",
|
||||
"oldfieldname": "min_order_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"description": "Select \"Yes\" if this item is used for some internal purpose in your company.",
|
||||
"fieldname": "is_asset_item",
|
||||
"fieldtype": "Select",
|
||||
"label": "Is Fixed Asset Item",
|
||||
"oldfieldname": "is_asset_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"fieldname": "has_batch_no",
|
||||
"fieldtype": "Select",
|
||||
"label": "Has Batch No",
|
||||
"oldfieldname": "has_batch_no",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"description": "Selecting \"Yes\" will give a unique identity to each entity of this item which can be viewed in the Serial No master.",
|
||||
"fieldname": "has_serial_no",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Has Serial No",
|
||||
"oldfieldname": "has_serial_no",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.has_serial_no===\"Yes\"",
|
||||
"description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.",
|
||||
"fieldname": "serial_no_series",
|
||||
"fieldtype": "Data",
|
||||
"label": "Serial Number Series",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"fieldname": "warranty_period",
|
||||
"fieldtype": "Data",
|
||||
"label": "Warranty Period (in days)",
|
||||
"oldfieldname": "warranty_period",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"description": "Net Weight of each Item",
|
||||
"fieldname": "net_weight",
|
||||
"fieldtype": "Float",
|
||||
"label": "Net Weight",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"fieldname": "weight_uom",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Weight UOM",
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"description": "Auto-raise Material Request if quantity goes below re-order level in default warehouse",
|
||||
"fieldname": "reorder_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Re-order",
|
||||
"options": "icon-rss",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item==\"Yes\" && !doc.apply_warehouse_wise_reorder_level)",
|
||||
"fieldname": "re_order_level",
|
||||
"fieldtype": "Float",
|
||||
"label": "Re-Order Level",
|
||||
"oldfieldname": "re_order_level",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item==\"Yes\" && !doc.apply_warehouse_wise_reorder_level)",
|
||||
"fieldname": "re_order_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Re-Order Qty",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
|
||||
"fieldname": "apply_warehouse_wise_reorder_level",
|
||||
"fieldtype": "Check",
|
||||
"label": "Apply Warehouse-wise Reorder Level",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item==\"Yes\" && doc.apply_warehouse_wise_reorder_level)",
|
||||
"fieldname": "section_break_31",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.is_stock_item==\"Yes\" && doc.apply_warehouse_wise_reorder_level)",
|
||||
"description": "Will also apply for variants unless overrridden",
|
||||
"fieldname": "reorder_levels",
|
||||
"fieldtype": "Table",
|
||||
"label": "Warehouse-wise Reorder Levels",
|
||||
"options": "Item Reorder",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "purchase_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "",
|
||||
"label": "Purchase Details",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-shopping-cart",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "Yes",
|
||||
"description": "Selecting \"Yes\" will allow this item to appear in Purchase Order , Purchase Receipt.",
|
||||
"default": "1",
|
||||
"description": "",
|
||||
"fieldname": "is_purchase_item",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Purchase Item",
|
||||
"oldfieldname": "is_purchase_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"fieldname": "default_supplier",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Supplier",
|
||||
"options": "Supplier",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"description": "Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Material Request when you select this item.",
|
||||
"depends_on": "is_purchase_item",
|
||||
"description": "Average time taken by the supplier to deliver",
|
||||
"fieldname": "lead_time_days",
|
||||
"fieldtype": "Int",
|
||||
"label": "Lead Time Days",
|
||||
"label": "Lead Time in days",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "lead_time_days",
|
||||
"oldfieldtype": "Int",
|
||||
@ -473,20 +465,7 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "",
|
||||
"description": "Default Purchase Account in which cost of the item will be debited.",
|
||||
"fieldname": "expense_account",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Expense Account",
|
||||
"oldfieldname": "purchase_account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "",
|
||||
"depends_on": "is_purchase_item",
|
||||
"description": "",
|
||||
"fieldname": "buying_cost_center",
|
||||
"fieldtype": "Link",
|
||||
@ -499,27 +478,28 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"fieldname": "last_purchase_rate",
|
||||
"fieldtype": "Float",
|
||||
"label": "Last Purchase Rate",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "last_purchase_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"depends_on": "is_purchase_item",
|
||||
"description": "",
|
||||
"fieldname": "expense_account",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Expense Account",
|
||||
"oldfieldname": "purchase_account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"fieldname": "column_break2",
|
||||
"depends_on": "is_purchase_item",
|
||||
"fieldname": "unit_of_measure_conversion",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"label": "Unit of Measure Conversion",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"depends_on": "is_purchase_item",
|
||||
"description": "Will also apply for variants",
|
||||
"fieldname": "uoms",
|
||||
"fieldtype": "Table",
|
||||
@ -532,7 +512,35 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"depends_on": "is_purchase_item",
|
||||
"fieldname": "last_purchase_rate",
|
||||
"fieldtype": "Float",
|
||||
"label": "Last Purchase Rate",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "last_purchase_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "is_purchase_item",
|
||||
"fieldname": "supplier_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Supplier Details",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item",
|
||||
"fieldname": "default_supplier",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Default Supplier",
|
||||
"options": "Supplier",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item",
|
||||
"fieldname": "manufacturer",
|
||||
"fieldtype": "Data",
|
||||
"label": "Manufacturer",
|
||||
@ -540,7 +548,7 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"depends_on": "eval:doc.is_purchase_item",
|
||||
"fieldname": "manufacturer_part_no",
|
||||
"fieldtype": "Data",
|
||||
"label": "Manufacturer Part Number",
|
||||
@ -548,7 +556,17 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
|
||||
"depends_on": "is_purchase_item",
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"label": "Item Code for Suppliers",
|
||||
"oldfieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"depends_on": "is_purchase_item",
|
||||
"fieldname": "supplier_items",
|
||||
"fieldtype": "Table",
|
||||
"label": "Supplier Items",
|
||||
@ -566,30 +584,30 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "Yes",
|
||||
"description": "Selecting \"Yes\" will allow this item to figure in Sales Order, Delivery Note",
|
||||
"default": "1",
|
||||
"description": "",
|
||||
"fieldname": "is_sales_item",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Check",
|
||||
"in_filter": 1,
|
||||
"label": "Is Sales Item",
|
||||
"oldfieldname": "is_sales_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
|
||||
"description": "Select \"Yes\" if this item represents some work like training, designing, consulting etc.",
|
||||
"default": "",
|
||||
"depends_on": "eval:doc.is_sales_item",
|
||||
"description": "Allow in Sales Order of type \"Service\"",
|
||||
"fieldname": "is_service_item",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Check",
|
||||
"in_filter": 1,
|
||||
"label": "Is Service Item",
|
||||
"oldfieldname": "is_service_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
@ -614,17 +632,7 @@
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
|
||||
"fieldname": "max_discount",
|
||||
"fieldtype": "Float",
|
||||
"label": "Max Discount (%)",
|
||||
"oldfieldname": "max_discount",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
|
||||
"depends_on": "is_sales_item",
|
||||
"fieldname": "income_account",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
@ -634,7 +642,7 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
|
||||
"depends_on": "is_sales_item",
|
||||
"fieldname": "selling_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
@ -644,17 +652,18 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
|
||||
"depends_on": "is_sales_item",
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"label": "Customer Item Codes",
|
||||
"oldfieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
|
||||
"description": "For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes",
|
||||
"depends_on": "is_sales_item",
|
||||
"description": "",
|
||||
"fieldname": "customer_items",
|
||||
"fieldtype": "Table",
|
||||
"label": "Customer Items",
|
||||
@ -662,6 +671,16 @@
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.is_sales_item",
|
||||
"fieldname": "max_discount",
|
||||
"fieldtype": "Float",
|
||||
"label": "Max Discount (%)",
|
||||
"oldfieldname": "max_discount",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "item_tax_section_break",
|
||||
"fieldtype": "Section Break",
|
||||
@ -692,20 +711,20 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"default": "",
|
||||
"fieldname": "inspection_required",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Check",
|
||||
"label": "Inspection Required",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "inspection_required",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.inspection_required==\"Yes\"",
|
||||
"depends_on": "inspection_required",
|
||||
"description": "Will also apply to variants",
|
||||
"fieldname": "quality_parameters",
|
||||
"fieldtype": "Table",
|
||||
@ -725,6 +744,39 @@
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "",
|
||||
"depends_on": "",
|
||||
"description": "",
|
||||
"fieldname": "is_pro_applicable",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Production Order",
|
||||
"oldfieldname": "is_pro_applicable",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "",
|
||||
"description": "If subcontracted to a vendor",
|
||||
"fieldname": "is_sub_contracted_item",
|
||||
"fieldtype": "Check",
|
||||
"label": "Supply Raw Materials for Purchase",
|
||||
"oldfieldname": "is_sub_contracted_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_74",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "",
|
||||
"fieldname": "default_bom",
|
||||
@ -738,33 +790,6 @@
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"depends_on": "",
|
||||
"description": "Selecting \"Yes\" will allow you to make a Production Order for this item.",
|
||||
"fieldname": "is_pro_applicable",
|
||||
"fieldtype": "Select",
|
||||
"label": "Allow Production Order",
|
||||
"oldfieldname": "is_pro_applicable",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "",
|
||||
"fieldname": "is_sub_contracted_item",
|
||||
"fieldtype": "Select",
|
||||
"label": "Supply Raw Materials for Purchase",
|
||||
"oldfieldname": "is_sub_contracted_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "customer_code",
|
||||
"fieldtype": "Data",
|
||||
@ -803,7 +828,7 @@
|
||||
},
|
||||
{
|
||||
"depends_on": "show_in_website",
|
||||
"description": "Products will be sorted by weight-age in default searches. More the weight-age, higher the product will appear in the list.",
|
||||
"description": "Items with higher weightage will be shown higher",
|
||||
"fieldname": "weightage",
|
||||
"fieldtype": "Int",
|
||||
"label": "Weightage",
|
||||
@ -865,6 +890,13 @@
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "website_specifications_cb",
|
||||
"fieldtype": "Column Break",
|
||||
"label": "Website Specifications",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"depends_on": "show_in_website",
|
||||
"fieldname": "copy_from_item_group",
|
||||
@ -903,7 +935,7 @@
|
||||
"icon": "icon-tag",
|
||||
"idx": 1,
|
||||
"max_attachments": 1,
|
||||
"modified": "2015-07-13 05:28:28.698107",
|
||||
"modified": "2015-07-24 06:04:28.448050",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
|
@ -87,7 +87,7 @@ class Item(WebsiteGenerator):
|
||||
return context
|
||||
|
||||
def check_warehouse_is_set_for_stock_item(self):
|
||||
if self.is_stock_item=="Yes" and not self.default_warehouse and frappe.get_all("Warehouse"):
|
||||
if self.is_stock_item==1 and not self.default_warehouse and frappe.get_all("Warehouse"):
|
||||
frappe.msgprint(_("Default Warehouse is mandatory for stock Item."),
|
||||
raise_exception=WarehouseNotSet)
|
||||
|
||||
@ -158,13 +158,13 @@ class Item(WebsiteGenerator):
|
||||
frappe.throw(_("Conversion factor for default Unit of Measure must be 1 in row {0}").format(d.idx))
|
||||
|
||||
def validate_item_type(self):
|
||||
if self.is_pro_applicable == 'Yes' and self.is_stock_item == 'No':
|
||||
if self.is_pro_applicable == 1 and self.is_stock_item==0:
|
||||
frappe.throw(_("As Production Order can be made for this item, it must be a stock item."))
|
||||
|
||||
if self.has_serial_no == 'Yes' and self.is_stock_item == 'No':
|
||||
if self.has_serial_no == 1 and self.is_stock_item == 0:
|
||||
msgprint(_("'Has Serial No' can not be 'Yes' for non-stock item"), raise_exception=1)
|
||||
|
||||
if self.has_serial_no == "No" and self.serial_no_series:
|
||||
if self.has_serial_no == 0 and self.serial_no_series:
|
||||
self.serial_no_series = None
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ class Item(WebsiteGenerator):
|
||||
vals = frappe.db.get_value("Item", self.name,
|
||||
["has_serial_no", "is_stock_item", "valuation_method", "has_batch_no"], as_dict=True)
|
||||
|
||||
if vals and ((self.is_stock_item == "No" and vals.is_stock_item == "Yes") or
|
||||
if vals and ((self.is_stock_item == 0 and vals.is_stock_item == 1) or
|
||||
vals.has_serial_no != self.has_serial_no or
|
||||
vals.has_batch_no != self.has_batch_no or
|
||||
cstr(vals.valuation_method) != cstr(self.valuation_method)):
|
||||
@ -353,7 +353,7 @@ def validate_is_stock_item(item_code, is_stock_item=None, verbose=1):
|
||||
if not is_stock_item:
|
||||
is_stock_item = frappe.db.get_value("Item", item_code, "is_stock_item")
|
||||
|
||||
if is_stock_item != "Yes":
|
||||
if is_stock_item != 1:
|
||||
msg = _("Item {0} is not a stock Item").format(item_code)
|
||||
|
||||
_msgprint(msg, verbose)
|
||||
@ -445,4 +445,3 @@ def invalidate_cache_for_item(doc):
|
||||
|
||||
if doc.get("old_item_group") and doc.get("old_item_group") != doc.item_group:
|
||||
invalidate_cache_for(doc, doc.old_item_group)
|
||||
|
||||
|
@ -24,13 +24,13 @@ class TestItem(unittest.TestCase):
|
||||
|
||||
def test_template_cannot_have_stock(self):
|
||||
item = self.get_item(10)
|
||||
se = make_stock_entry(item_code=item.name, target="Stores - _TC", qty=1, incoming_rate=1)
|
||||
make_stock_entry(item_code=item.name, target="Stores - _TC", qty=1, incoming_rate=1)
|
||||
item.has_variants = 1
|
||||
self.assertRaises(ItemTemplateCannotHaveStock, item.save)
|
||||
|
||||
def test_default_warehouse(self):
|
||||
item = frappe.copy_doc(test_records[0])
|
||||
item.is_stock_item = "Yes"
|
||||
item.is_stock_item = 1
|
||||
item.default_warehouse = None
|
||||
self.assertRaises(WarehouseNotSet, item.insert)
|
||||
|
||||
|
@ -5,17 +5,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Item",
|
||||
"item_group": "_Test Item Group",
|
||||
"item_name": "_Test Item",
|
||||
@ -38,17 +38,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Item 2",
|
||||
"item_group": "_Test Item Group",
|
||||
"item_name": "_Test Item 2",
|
||||
@ -62,17 +62,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop 100",
|
||||
@ -92,17 +92,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Item Home Desktop 200",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop 200",
|
||||
@ -113,17 +113,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "No",
|
||||
"is_sub_contracted_item": "No",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 0,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Product Bundle Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Product Bundle Item",
|
||||
@ -135,17 +135,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "Yes",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 1,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 1,
|
||||
"item_code": "_Test FG Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test FG Item",
|
||||
@ -154,16 +154,16 @@
|
||||
{
|
||||
"description": "_Test Non Stock Item 7",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "No",
|
||||
"is_sub_contracted_item": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 0,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Non Stock Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Non Stock Item",
|
||||
@ -173,16 +173,16 @@
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Serialized Item 8",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "Yes",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 1,
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Serialized Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Serialized Item",
|
||||
@ -192,16 +192,16 @@
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"description": "_Test Serialized Item 9",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "Yes",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "No",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 1,
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Serialized Item With Series",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Serialized Item With Series",
|
||||
@ -214,16 +214,16 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "No",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Item Home Desktop Manufactured",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Item Home Desktop Manufactured",
|
||||
@ -235,17 +235,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "Yes",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 1,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 1,
|
||||
"item_code": "_Test FG Item 2",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test FG Item 2",
|
||||
@ -257,17 +257,17 @@
|
||||
"doctype": "Item",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "No",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"income_account": "Sales - _TC",
|
||||
"inspection_required": "No",
|
||||
"is_asset_item": "No",
|
||||
"is_pro_applicable": "Yes",
|
||||
"is_purchase_item": "Yes",
|
||||
"is_sales_item": "Yes",
|
||||
"is_service_item": "No",
|
||||
"is_stock_item": "Yes",
|
||||
"is_sub_contracted_item": "Yes",
|
||||
"inspection_required": 0,
|
||||
"is_asset_item": 0,
|
||||
"is_pro_applicable": 1,
|
||||
"is_purchase_item": 1,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 0,
|
||||
"is_stock_item": 1,
|
||||
"is_sub_contracted_item": 1,
|
||||
"item_code": "_Test Variant Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"item_name": "_Test Variant Item",
|
||||
|
@ -15,7 +15,7 @@ class LandedCostVoucher(Document):
|
||||
pr_items = frappe.db.sql("""select pr_item.item_code, pr_item.description,
|
||||
pr_item.qty, pr_item.base_rate, pr_item.base_amount, pr_item.name
|
||||
from `tabPurchase Receipt Item` pr_item where parent = %s
|
||||
and exists(select name from tabItem where name = pr_item.item_code and is_stock_item = 'Yes')""",
|
||||
and exists(select name from tabItem where name = pr_item.item_code and is_stock_item = 1)""",
|
||||
pr.purchase_receipt, as_dict=True)
|
||||
|
||||
for d in pr_items:
|
||||
|
@ -152,7 +152,7 @@ class MaterialRequest(BuyingController):
|
||||
item_wh_list = []
|
||||
for d in self.get("items"):
|
||||
if (not mr_item_rows or d.name in mr_item_rows) and [d.item_code, d.warehouse] not in item_wh_list \
|
||||
and frappe.db.get_value("Item", d.item_code, "is_stock_item") == "Yes" and d.warehouse:
|
||||
and frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 and d.warehouse:
|
||||
item_wh_list.append([d.item_code, d.warehouse])
|
||||
|
||||
for item_code, warehouse in item_wh_list:
|
||||
|
@ -198,10 +198,7 @@ class PurchaseReceipt(BuyingController):
|
||||
|
||||
def validate_inspection(self):
|
||||
for d in self.get('items'): #Enter inspection date for all items that require inspection
|
||||
ins_reqd = frappe.db.sql("select inspection_required from `tabItem` where name = %s",
|
||||
(d.item_code,), as_dict = 1)
|
||||
ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No'
|
||||
if ins_reqd == 'Yes' and not d.qa_no:
|
||||
if frappe.db.get_value("Item", d.item_code, "inspection_required") and not d.qa_no:
|
||||
frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code))
|
||||
if self.docstatus==1:
|
||||
raise frappe.ValidationError
|
||||
|
@ -11,7 +11,7 @@ cur_frm.add_fetch("item_code", "brand", "brand")
|
||||
|
||||
cur_frm.cscript.onload = function() {
|
||||
cur_frm.set_query("item_code", function() {
|
||||
return erpnext.queries.item({"is_stock_item": "Yes", "has_serial_no": "Yes"})
|
||||
return erpnext.queries.item({"is_stock_item": 1, "has_serial_no": 1})
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ class SerialNo(StockController):
|
||||
Validate whether serial no is required for this item
|
||||
"""
|
||||
item = frappe.get_doc("Item", self.item_code)
|
||||
if item.has_serial_no!="Yes":
|
||||
if item.has_serial_no!=1:
|
||||
frappe.throw(_("Item {0} is not setup for Serial Nos. Check Item master").format(self.item_code))
|
||||
|
||||
self.item_group = item.item_group
|
||||
@ -198,7 +198,7 @@ def process_serial_no(sle):
|
||||
update_serial_nos(sle, item_det)
|
||||
|
||||
def validate_serial_no(sle, item_det):
|
||||
if item_det.has_serial_no=="No":
|
||||
if item_det.has_serial_no==0:
|
||||
if sle.serial_no:
|
||||
frappe.throw(_("Item {0} is not setup for Serial Nos. Column must be blank").format(sle.item_code),
|
||||
SerialNoNotRequiredError)
|
||||
@ -246,7 +246,7 @@ def validate_serial_no(sle, item_det):
|
||||
|
||||
def update_serial_nos(sle, item_det):
|
||||
if sle.is_cancelled == "No" and not sle.serial_no and sle.actual_qty > 0 \
|
||||
and item_det.has_serial_no == "Yes" and item_det.serial_no_series:
|
||||
and item_det.has_serial_no == 1 and item_det.serial_no_series:
|
||||
from frappe.model.naming import make_autoname
|
||||
serial_nos = []
|
||||
for i in xrange(cint(sle.actual_qty)):
|
||||
|
@ -15,7 +15,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
};
|
||||
|
||||
this.frm.fields_dict.items.grid.get_field('item_code').get_query = function() {
|
||||
return erpnext.queries.item({is_stock_item: "Yes"});
|
||||
return erpnext.queries.item({is_stock_item: 1});
|
||||
};
|
||||
|
||||
this.frm.set_query("purchase_order", function() {
|
||||
|
@ -64,18 +64,18 @@ class StockLedgerEntry(Document):
|
||||
|
||||
item_det = item_det[0]
|
||||
|
||||
if item_det.is_stock_item != 'Yes':
|
||||
if item_det.is_stock_item != 1:
|
||||
frappe.throw(_("Item {0} must be a stock Item").format(self.item_code))
|
||||
|
||||
# check if batch number is required
|
||||
if self.voucher_type != 'Stock Reconciliation':
|
||||
if item_det.has_batch_no =='Yes':
|
||||
if item_det.has_batch_no ==1:
|
||||
if not self.batch_no:
|
||||
frappe.throw(_("Batch number is mandatory for Item {0}").format(self.item_code))
|
||||
elif not frappe.db.get_value("Batch",{"item": self.item_code, "name": self.batch_no}):
|
||||
frappe.throw(_("{0} is not a valid Batch Number for Item {1}").format(self.batch_no, self.item_code))
|
||||
|
||||
elif item_det.has_batch_no =='No' and self.batch_no:
|
||||
elif item_det.has_batch_no ==0 and self.batch_no:
|
||||
frappe.throw(_("The Item {0} cannot have Batch").format(self.item_code))
|
||||
|
||||
if item_det.has_variants:
|
||||
|
@ -134,12 +134,12 @@ class StockReconciliation(StockController):
|
||||
validate_is_stock_item(item_code, item.is_stock_item, verbose=0)
|
||||
|
||||
# item should not be serialized
|
||||
if item.has_serial_no == "Yes":
|
||||
if item.has_serial_no == 1:
|
||||
raise frappe.ValidationError, _("Serialized Item {0} cannot be updated \
|
||||
using Stock Reconciliation").format(item_code)
|
||||
|
||||
# item managed batch-wise not allowed
|
||||
if item.has_batch_no == "Yes":
|
||||
if item.has_batch_no == 1:
|
||||
raise frappe.ValidationError, _("Item: {0} managed batch-wise, can not be reconciled using \
|
||||
Stock Reconciliation, instead use Stock Entry").format(item_code)
|
||||
|
||||
@ -242,7 +242,7 @@ class StockReconciliation(StockController):
|
||||
@frappe.whitelist()
|
||||
def get_items(warehouse, posting_date, posting_time):
|
||||
items = frappe.get_list("Item", fields=["name"], filters=
|
||||
{"is_stock_item": "Yes", "has_serial_no": "No", "has_batch_no": "No"})
|
||||
{"is_stock_item": 1, "has_serial_no": 0, "has_batch_no": 0})
|
||||
for item in items:
|
||||
item.item_code = item.name
|
||||
item.warehouse = warehouse
|
||||
|
@ -4,7 +4,7 @@
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function() {
|
||||
cur_frm.set_query("item_code", function() {
|
||||
return erpnext.queries.item({"is_stock_item": "Yes"});
|
||||
return erpnext.queries.item({"is_stock_item": 1});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -146,7 +146,7 @@ class Warehouse(Document):
|
||||
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
|
||||
|
||||
for item in frappe.db.sql("""select distinct item_code from (
|
||||
select name as item_code from `tabItem` where ifnull(is_stock_item, 'Yes')='Yes'
|
||||
select name as item_code from `tabItem` where is_stock_item=1
|
||||
union
|
||||
select distinct item_code from tabBin) a"""):
|
||||
repost_stock(item[0], newdn)
|
||||
|
@ -37,7 +37,6 @@ def get_item_details(args):
|
||||
item_doc = frappe.get_doc("Item", args.item_code)
|
||||
item = item_doc
|
||||
|
||||
|
||||
validate_item_details(args, item)
|
||||
|
||||
out = get_basic_details(args, item)
|
||||
@ -61,7 +60,7 @@ def get_item_details(args):
|
||||
out.update(get_pricing_rule_for_item(args))
|
||||
|
||||
if args.get("parenttype") in ("Sales Invoice", "Delivery Note"):
|
||||
if item_doc.has_serial_no == "Yes" and not args.serial_no:
|
||||
if item_doc.has_serial_no == 1 and not args.serial_no:
|
||||
out.serial_no = get_serial_nos_by_fifo(args, item_doc)
|
||||
|
||||
if args.transaction_date and item.lead_time_days:
|
||||
@ -119,10 +118,10 @@ def validate_item_details(args, item):
|
||||
if args.transaction_type == "selling":
|
||||
# validate if sales item or service item
|
||||
if args.get("order_type") == "Maintenance":
|
||||
if item.is_service_item != "Yes":
|
||||
if item.is_service_item != 1:
|
||||
throw(_("Item {0} must be a Service Item.").format(item.name))
|
||||
|
||||
elif item.is_sales_item != "Yes":
|
||||
elif item.is_sales_item != 1:
|
||||
throw(_("Item {0} must be a Sales Item").format(item.name))
|
||||
|
||||
if cint(item.has_variants):
|
||||
@ -130,10 +129,10 @@ def validate_item_details(args, item):
|
||||
|
||||
elif args.transaction_type == "buying" and args.parenttype != "Material Request":
|
||||
# validate if purchase item or subcontracted item
|
||||
if item.is_purchase_item != "Yes":
|
||||
if item.is_purchase_item != 1:
|
||||
throw(_("Item {0} must be a Purchase Item").format(item.name))
|
||||
|
||||
if args.get("is_subcontracted") == "Yes" and item.is_sub_contracted_item != "Yes":
|
||||
if args.get("is_subcontracted") == "Yes" and item.is_sub_contracted_item != 1:
|
||||
throw(_("Item {0} must be a Sub-contracted Item").format(item.name))
|
||||
|
||||
def get_basic_details(args, item):
|
||||
|
@ -69,7 +69,7 @@ def get_item_warehouse_projected_qty():
|
||||
from tabBin where ifnull(item_code, '') != '' and ifnull(warehouse, '') != ''
|
||||
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
|
||||
is_stock_item=1 and (is_purchase_item=1 or is_sub_contracted_item=1) and
|
||||
(ifnull(end_of_life, '0000-00-00')='0000-00-00' or end_of_life > %s))
|
||||
and exists (select name from `tabWarehouse`
|
||||
where `tabWarehouse`.name = `tabBin`.warehouse
|
||||
|
@ -10,7 +10,7 @@
|
||||
"module": "Stock",
|
||||
"name": "Items To Be Requested",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = \"Yes\"\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC",
|
||||
"query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = 1\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC",
|
||||
"ref_doctype": "Item",
|
||||
"report_name": "Items To Be Requested",
|
||||
"report_type": "Query Report"
|
||||
|
@ -81,7 +81,7 @@ def get_suppliers_details(filters):
|
||||
`tabPurchase Receipt` pr, `tabPurchase Receipt Item` pri
|
||||
where pr.name=pri.parent and pr.docstatus=1 and
|
||||
pri.item_code=(select name from `tabItem` where
|
||||
ifnull(is_stock_item, 'Yes')='Yes' and name=pri.item_code)""", as_dict=1):
|
||||
is_stock_item=1 and name=pri.item_code)""", as_dict=1):
|
||||
item_supplier_map.setdefault(d.item_code, []).append(d.supplier)
|
||||
|
||||
if supplier:
|
||||
|
@ -81,7 +81,7 @@ def get_bin(item_code, warehouse):
|
||||
|
||||
def update_bin(args, allow_negative_stock=False, via_landed_cost_voucher=False):
|
||||
is_stock_item = frappe.db.get_value('Item', args.get("item_code"), 'is_stock_item')
|
||||
if is_stock_item == 'Yes':
|
||||
if is_stock_item:
|
||||
bin = get_bin(args.get("item_code"), args.get("warehouse"))
|
||||
bin.update_stock(args, allow_negative_stock, via_landed_cost_voucher)
|
||||
return bin
|
||||
@ -173,4 +173,3 @@ def validate_warehouse_company(warehouse, company):
|
||||
if warehouse_company and warehouse_company != company:
|
||||
frappe.throw(_("Warehouse {0} does not belong to company {1}").format(warehouse, company),
|
||||
InvalidWarehouseCompany)
|
||||
|
||||
|
@ -102,7 +102,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters:{ 'is_service_item': "Yes" }
|
||||
filters:{ 'is_service_item': 1 }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.fields_dict['purposes'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{ 'is_service_item': "Yes"}
|
||||
filters:{ 'is_service_item': 1}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ def set_stock_balance_as_per_serial_no(item_code=None, posting_date=None, postin
|
||||
|
||||
bin = frappe.db.sql("""select bin.item_code, bin.warehouse, bin.actual_qty, item.stock_uom
|
||||
from `tabBin` bin, tabItem item
|
||||
where bin.item_code = item.name and item.has_serial_no = 'Yes' %s""" % condition)
|
||||
where bin.item_code = item.name and item.has_serial_no = 1 %s""" % condition)
|
||||
|
||||
for d in bin:
|
||||
serial_nos = frappe.db.sql("""select count(name) from `tabSerial No`
|
||||
|
Loading…
x
Reference in New Issue
Block a user