Merge branch 'master' into dev
Conflicts:
erpnext/buying/doctype/quality_inspection/quality_inspection.py
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
index 1519268..698c1a2 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
@@ -8,11 +8,11 @@
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Please edit this list and import only required elements
import webnotes
@@ -34,30 +34,35 @@
class DocType:
- def __init__(self, doc, doclist=[]):
- self.doc = doc
- self.doclist = doclist
+ def __init__(self, doc, doclist=[]):
+ self.doc = doc
+ self.doclist = doclist
- # Autoname
- # ---------
- def autoname(self):
- self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+ # Autoname
+ # ---------
+ def autoname(self):
+ self.doc.name = make_autoname(self.doc.naming_series+'.#####')
- def get_item_specification_details(self):
- self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
- specification = sql("select specification, value from `tabItem Quality Inspection Parameter` where parent = '%s' order by idx" % (self.doc.item_code))
- for d in specification:
- child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist)
- child.specification = d[0]
- child.value = d[1]
- child.status = 'Accepted'
+ def get_item_specification_details(self):
+ self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
+ specification = sql("select specification, value from `tabItem Quality Inspection Parameter` \
+ where parent = '%s' order by idx" % (self.doc.item_code))
+ for d in specification:
+ child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist)
+ child.specification = d[0]
+ child.value = d[1]
+ child.status = 'Accepted'
- def on_submit(self):
- if self.doc.purchase_receipt_no:
- sql("update `tabPurchase Receipt Item` set qa_no = '%s' where parent = '%s' and item_code = '%s'" % (self.doc.name, self.doc.purchase_receipt_no, self.doc.item_code))
+ def on_submit(self):
+ if self.doc.purchase_receipt_no:
+ sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
+ where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
+ % (self.doc.name, self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
+
-
- def on_cancel(self):
- if self.doc.purchase_receipt_no:
- sql("update `tabPurchase Receipt Item` set qa_no = '' where parent = '%s' and item_code = '%s'" % (self.doc.purchase_receipt_no, self.doc.item_code))
+ def on_cancel(self):
+ if self.doc.purchase_receipt_no:
+ sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
+ where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
+ % (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
diff --git a/erpnext/hr/doctype/employee/listview.js b/erpnext/hr/doctype/employee/listview.js
index 4f92bbf..fbd338e 100644
--- a/erpnext/hr/doctype/employee/listview.js
+++ b/erpnext/hr/doctype/employee/listview.js
@@ -12,8 +12,9 @@
"`tabEmployee`.company",
"`tabEmployee`.reports_to",
"`tabEmployee`.date_of_joining",
+ "`tabEmployee`.status",
]);
- this.stats = this.stats.concat(['company']);
+ this.stats = this.stats.concat(['status', 'company']);
},
prepare_data: function(data) {
@@ -32,14 +33,22 @@
data.company && concat_list.push(data.company);
data.branch && concat_list.push(data.branch);
data.description = concat_list.join(", ");
+
+ if(data.status=='Left') {
+ data.label_type = 'important';
+ } else if(data.status=='Active') {
+ data.label_type = 'success';
+ }
+ data.status_html = repl('<span class="label label-%(label_type)s" \
+ support_list_status="%(status)s">%(status)s</span>', data);
},
columns: [
{width: '3%', content: 'check'},
- {width: '3%', content: 'docstatus'},
{width: '12%', content: 'name'},
{width: '25%', content: 'employee_name'},
- {width: '45%', content: 'description+tags',
+ {width: '10%', content: 'status_html'},
+ {width: '38%', content: 'description+tags',
css: {'color': '#aaa'}},
{width: '12%', content:'date_of_joining',
css: {'text-align': 'right', 'color': '#777'}},
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 7228855..718bc86 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -159,6 +159,10 @@
ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
ret['base_ref_rate'] = flt(base_ref_rate)
ret['basic_rate'] = flt(base_ref_rate)
+
+ if ret['warehouse'] or ret['reserved_warehouse']:
+ av_qty = self.get_available_qty({'item_code': args['item_code'], 'warehouse': ret['warehouse'] or ret['reserved_warehouse']})
+ ret.update(av_qty)
return ret
@@ -175,6 +179,14 @@
return ret
+ def get_available_qty(self,args):
+ tot_avail_qty = webnotes.conn.sql("select projected_qty, actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
+ ret = {
+ 'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
+ 'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
+ }
+ return ret
+
# ***************** Get Ref rate as entered in Item Master ********************
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index aadad61..02bffca 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -117,13 +117,7 @@
# Get projected qty of item based on warehouse selected
# -----------------------------------------------------
def get_available_qty(self,args):
- args = eval(args)
- tot_avail_qty = sql("select projected_qty, actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
- ret = {
- 'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
- 'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
- }
- return ret
+ return get_obj('Sales Common').get_available_qty(eval(args))
# OTHER CHARGES TRIGGER FUNCTIONS
# ====================================================================================
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index ce5f9dd..5242f24 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -175,7 +175,7 @@
if (doc.delivery_type = 'Sample') cfn_set_fields(doc, cdt, cdn);
}
-cur_frm.cscript.serial_no = function(doc, cdt , cdn) {
+cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if (d.serial_no) {
get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 5ecf63a..45ceb24 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -133,12 +133,7 @@
# ********** Get Actual Qty of item in warehouse selected *************
def get_actual_qty(self,args):
- args = eval(args)
- actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
- ret = {
- 'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
- }
- return ret
+ return get_obj('Sales Common').get_available_qty(eval(args))
# OTHER CHARGES TRIGGER FUNCTIONS
diff --git a/erpnext/support/doctype/support_ticket/listview.js b/erpnext/support/doctype/support_ticket/listview.js
index 3bbb197..c594d2a 100644
--- a/erpnext/support/doctype/support_ticket/listview.js
+++ b/erpnext/support/doctype/support_ticket/listview.js
@@ -29,10 +29,7 @@
data.status = 'Waiting'
}
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
- var a = $(data.status_html).click(function() {
- me.set_filter('status', $(this).text());
- });
-
+
// escape double quotes
data.description = cstr(data.subject)
+ " | " + cstr(data.description);