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,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# 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.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# 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
|
# Please edit this list and import only required elements
|
||||||
import webnotes
|
import webnotes
|
||||||
@ -34,30 +34,35 @@ convert_to_lists = webnotes.conn.convert_to_lists
|
|||||||
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
# Autoname
|
# Autoname
|
||||||
# ---------
|
# ---------
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||||
|
|
||||||
|
|
||||||
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` \
|
||||||
for d in specification:
|
where parent = '%s' order by idx" % (self.doc.item_code))
|
||||||
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist)
|
for d in specification:
|
||||||
child.specification = d[0]
|
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist)
|
||||||
child.value = d[1]
|
child.specification = d[0]
|
||||||
child.status = 'Accepted'
|
child.value = d[1]
|
||||||
|
child.status = 'Accepted'
|
||||||
|
|
||||||
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))
|
||||||
|
|||||||
@ -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'}},
|
||||||
|
|||||||
@ -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):
|
||||||
|
|||||||
@ -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
|
||||||
# ====================================================================================
|
# ====================================================================================
|
||||||
|
|||||||
@ -175,7 +175,7 @@ cur_frm.cscript.delivery_type = function(doc, cdt, cdn) {
|
|||||||
if (doc.delivery_type = 'Sample') cfn_set_fields(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];
|
var d = locals[cdt][cdn];
|
||||||
if (d.serial_no) {
|
if (d.serial_no) {
|
||||||
get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
|
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 *************
|
# ********** 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
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user