From 26320fc755919b4ba2f0b435eacd075f64f8558f Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 15 Dec 2014 17:42:33 +0530 Subject: [PATCH] batch redesigned --- erpnext/stock/doctype/batch/batch.js | 5 +- erpnext/stock/doctype/batch/batch.json | 50 ++++++++++++------- erpnext/stock/doctype/batch/batch.py | 5 +- erpnext/stock/doctype/batch/test_records.json | 6 +++ 4 files changed, 42 insertions(+), 24 deletions(-) create mode 100644 erpnext/stock/doctype/batch/test_records.json diff --git a/erpnext/stock/doctype/batch/batch.js b/erpnext/stock/doctype/batch/batch.js index cc142ed566..18e52b48a6 100644 --- a/erpnext/stock/doctype/batch/batch.js +++ b/erpnext/stock/doctype/batch/batch.js @@ -5,7 +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' + 'is_stock_item': 'Yes', + 'has_batch_no': 'Yes' } } -} \ No newline at end of file +} diff --git a/erpnext/stock/doctype/batch/batch.json b/erpnext/stock/doctype/batch/batch.json index 5edf29242a..c586725fc4 100644 --- a/erpnext/stock/doctype/batch/batch.json +++ b/erpnext/stock/doctype/batch/batch.json @@ -1,7 +1,7 @@ { - "allow_import": 1, + "allow_import": 1, "autoname": "field:batch_id", - "creation": "2013-03-05 14:50:38.000000", + "creation": "2013-03-05 14:50:38", "docstatus": 0, "doctype": "DocType", "document_type": "Master", @@ -28,23 +28,10 @@ "reqd": 1 }, { - "fieldname": "description", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Small Text", + "fieldname": "column_break_3", + "fieldtype": "Column Break", "permlevel": 0, - "width": "300px" - }, - { - "fieldname": "expiry_date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Expiry Date", - "oldfieldname": "expiry_date", - "oldfieldtype": "Date", - "permlevel": 0 + "precision": "" }, { "fieldname": "start_date", @@ -61,12 +48,37 @@ "oldfieldname": "finished_date", "oldfieldtype": "Date", "permlevel": 0 + }, + { + "fieldname": "expiry_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Expiry Date", + "oldfieldname": "expiry_date", + "oldfieldtype": "Date", + "permlevel": 0 + }, + { + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "description", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Batch Description", + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "permlevel": 0, + "width": "300px" } ], "icon": "icon-archive", "idx": 1, "max_attachments": 5, - "modified": "2014-01-20 17:48:24.000000", + "modified": "2014-12-15 17:37:01.781726", "modified_by": "Administrator", "module": "Stock", "name": "Batch", diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 8b6aed7560..5b6f799de0 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -12,6 +12,5 @@ class Batch(Document): self.item_has_batch_enabled() def item_has_batch_enabled(self): - has_batch_no = frappe.db.get_value("Item",self.item,"has_batch_no") - if has_batch_no =='No': - frappe.throw(_("The selected item cannot have Batch")) \ No newline at end of file + if frappe.db.get_value("Item",self.item,"has_batch_no") =='No': + frappe.throw(_("The selected item cannot have Batch")) diff --git a/erpnext/stock/doctype/batch/test_records.json b/erpnext/stock/doctype/batch/test_records.json new file mode 100644 index 0000000000..172cdee83c --- /dev/null +++ b/erpnext/stock/doctype/batch/test_records.json @@ -0,0 +1,6 @@ +[ + { + "doctype": "Batch", + "name": "_Test Batch 1" + } +]