Merge branch 'master' into dev
Conflicts: erpnext/buying/doctype/quality_inspection/quality_inspection.py
This commit is contained in:
commit
e301e8a6c1
@ -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 @@ convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
|
||||
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))
|
||||
|
@ -12,8 +12,9 @@ wn.doclistviews['Employee'] = wn.views.ListView.extend({
|
||||
"`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 @@ wn.doclistviews['Employee'] = wn.views.ListView.extend({
|
||||
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'}},
|
||||
|
@ -159,6 +159,10 @@ class DocType(TransactionBase):
|
||||
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 @@ class DocType(TransactionBase):
|
||||
|
||||
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):
|
||||
|
@ -117,13 +117,7 @@ class DocType(TransactionBase):
|
||||
# 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
|
||||
# ====================================================================================
|
||||
|
@ -175,7 +175,7 @@ cur_frm.cscript.delivery_type = function(doc, cdt, cdn) {
|
||||
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);
|
||||
|
@ -133,12 +133,7 @@ class DocType(TransactionBase):
|
||||
|
||||
# ********** 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
|
||||
|
@ -29,10 +29,7 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user