Skip to content

Commit

Permalink
[revert] is_sales_item, is_purchase_item back
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta committed Aug 16, 2016
1 parent de08639 commit d973c16
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ 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 {
query: "erpnext.controllers.queries.item_query"
query: "erpnext.controllers.queries.item_query",
filters: {'is_purchase_item': 1}
}
}

Expand Down
3 changes: 2 additions & 1 deletion erpnext/buying/doctype/purchase_common/purchase_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}
} else {
return{
query: "erpnext.controllers.queries.item_query"
query: "erpnext.controllers.queries.item_query",
filters: {'is_purchase_item': 1}
}
}
});
Expand Down
3 changes: 2 additions & 1 deletion erpnext/crm/doctype/opportunity/opportunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({

this.frm.set_query("item_code", "items", function() {
return {
query: "erpnext.controllers.queries.item_query"
query: "erpnext.controllers.queries.item_query",
filters: {'is_sales_item': 1}
};
});

Expand Down
3 changes: 1 addition & 2 deletions erpnext/patches/v5_2/change_item_selects_to_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

def execute():
fields = ("is_stock_item", "is_asset_item", "has_batch_no", "has_serial_no",
"inspection_required", "is_sub_contracted_item")

"is_sales_item", "is_purchase_item", "inspection_required", "is_sub_contracted_item")

# convert to 1 or 0
update_str = ", ".join(["`{0}`=if(`{0}`='Yes',1,0)".format(f) for f in fields])
Expand Down
3 changes: 2 additions & 1 deletion erpnext/selling/sales_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
if(this.frm.fields_dict["items"].grid.get_field('item_code')) {
this.frm.set_query("item_code", "items", function() {
return {
query: "erpnext.controllers.queries.item_query"
query: "erpnext.controllers.queries.item_query",
filters: {'is_sales_item': 1}
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions erpnext/setup/setup_wizard/sample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def make_sample_data():
"""Create a few opportunities, quotes, material requests, issues, todos, projects
to help the user get started"""
items = frappe.get_all("Item")
items = frappe.get_all("Item", {'is_sales_item': 1})

customers = frappe.get_all("Customer")
warehouses = frappe.get_all("Warehouse")
Expand All @@ -25,7 +25,7 @@ def make_sample_data():
make_projects()

if items and warehouses:
make_material_request(items)
make_material_request(frappe.get_all("Item"))

frappe.db.commit()

Expand Down
2 changes: 2 additions & 0 deletions erpnext/setup/setup_wizard/setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ def create_items(args):
"item_name": item,
"description": item,
"show_in_website": 1,
"is_sales_item": is_sales_item,
"is_purchase_item": is_purchase_item,
"is_stock_item": is_stock_item and 1 or 0,
"item_group": item_group,
"stock_uom": args.get("item_uom_" + str(i)),
Expand Down
81 changes: 53 additions & 28 deletions erpnext/stock/doctype/item/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,33 +705,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Purchase",
"fieldname": "default_material_request_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Material Request Type",
"length": 0,
"no_copy": 0,
"options": "Purchase\nMaterial Transfer\nMaterial Issue\nManufacture",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
Expand Down Expand Up @@ -1054,6 +1027,32 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "1",
"fieldname": "is_purchase_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Purchase Item",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
Expand Down Expand Up @@ -1483,6 +1482,32 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "1",
"fieldname": "is_sales_item",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Sales Item",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
Expand Down Expand Up @@ -2335,7 +2360,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2016-08-03 17:30:51.323382",
"modified": "2016-08-16 01:59:49.494629",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
Expand Down

0 comments on commit d973c16

Please sign in to comment.