Merge branch 'master' into dev

Conflicts:
	erpnext/buying/doctype/quality_inspection/quality_inspection.py
This commit is contained in:
Anand Doshi 2012-06-28 18:40:57 +05:30
commit e301e8a6c1
7 changed files with 57 additions and 45 deletions

View File

@ -46,7 +46,8 @@ class DocType:
def get_item_specification_details(self): def get_item_specification_details(self):
self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details') 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)) specification = sql("select specification, value from `tabItem Quality Inspection Parameter` \
where parent = '%s' order by idx" % (self.doc.item_code))
for d in specification: for d in specification:
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist) child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist)
child.specification = d[0] child.specification = d[0]
@ -55,9 +56,13 @@ class DocType:
def on_submit(self): def on_submit(self):
if self.doc.purchase_receipt_no: 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)) 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): def on_cancel(self):
if self.doc.purchase_receipt_no: 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)) 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))

View File

@ -12,8 +12,9 @@ wn.doclistviews['Employee'] = wn.views.ListView.extend({
"`tabEmployee`.company", "`tabEmployee`.company",
"`tabEmployee`.reports_to", "`tabEmployee`.reports_to",
"`tabEmployee`.date_of_joining", "`tabEmployee`.date_of_joining",
"`tabEmployee`.status",
]); ]);
this.stats = this.stats.concat(['company']); this.stats = this.stats.concat(['status', 'company']);
}, },
prepare_data: function(data) { prepare_data: function(data) {
@ -32,14 +33,22 @@ wn.doclistviews['Employee'] = wn.views.ListView.extend({
data.company && concat_list.push(data.company); data.company && concat_list.push(data.company);
data.branch && concat_list.push(data.branch); data.branch && concat_list.push(data.branch);
data.description = concat_list.join(", "); 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: [ columns: [
{width: '3%', content: 'check'}, {width: '3%', content: 'check'},
{width: '3%', content: 'docstatus'},
{width: '12%', content: 'name'}, {width: '12%', content: 'name'},
{width: '25%', content: 'employee_name'}, {width: '25%', content: 'employee_name'},
{width: '45%', content: 'description+tags', {width: '10%', content: 'status_html'},
{width: '38%', content: 'description+tags',
css: {'color': '#aaa'}}, css: {'color': '#aaa'}},
{width: '12%', content:'date_of_joining', {width: '12%', content:'date_of_joining',
css: {'text-align': 'right', 'color': '#777'}}, css: {'text-align': 'right', 'color': '#777'}},

View File

@ -159,6 +159,10 @@ class DocType(TransactionBase):
ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate) ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
ret['base_ref_rate'] = flt(base_ref_rate) ret['base_ref_rate'] = flt(base_ref_rate)
ret['basic_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 return ret
@ -175,6 +179,14 @@ class DocType(TransactionBase):
return ret 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 ******************** # ***************** Get Ref rate as entered in Item Master ********************
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate): def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):

View File

@ -117,13 +117,7 @@ class DocType(TransactionBase):
# Get projected qty of item based on warehouse selected # Get projected qty of item based on warehouse selected
# ----------------------------------------------------- # -----------------------------------------------------
def get_available_qty(self,args): def get_available_qty(self,args):
args = eval(args) return get_obj('Sales Common').get_available_qty(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
# OTHER CHARGES TRIGGER FUNCTIONS # OTHER CHARGES TRIGGER FUNCTIONS
# ==================================================================================== # ====================================================================================

View File

@ -133,12 +133,7 @@ class DocType(TransactionBase):
# ********** Get Actual Qty of item in warehouse selected ************* # ********** Get Actual Qty of item in warehouse selected *************
def get_actual_qty(self,args): def get_actual_qty(self,args):
args = eval(args) return get_obj('Sales Common').get_available_qty(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
# OTHER CHARGES TRIGGER FUNCTIONS # OTHER CHARGES TRIGGER FUNCTIONS

View File

@ -29,9 +29,6 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
data.status = 'Waiting' data.status = 'Waiting'
} }
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data); 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 // escape double quotes
data.description = cstr(data.subject) data.description = cstr(data.subject)