Merge branch 'hotfix'

This commit is contained in:
Saurabh 2017-11-10 15:53:43 +05:30
commit 241139001e
6 changed files with 17 additions and 16 deletions

View File

@ -4,7 +4,7 @@ import inspect
import frappe import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
__version__ = '9.2.8' __version__ = '9.2.9'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -185,7 +185,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
"page_len": page_len "page_len": page_len
}, as_dict=as_dict) }, as_dict=as_dict)
def bom(doctype, txt, searchfield, filters, start=0, page_len=20): def bom(doctype, txt, searchfield, start, page_len, filters):
conditions = [] conditions = []
return frappe.db.sql("""select tabBOM.name, tabBOM.item return frappe.db.sql("""select tabBOM.name, tabBOM.item
@ -204,8 +204,8 @@ def bom(doctype, txt, searchfield, filters, start=0, page_len=20):
{ {
'txt': "%%%s%%" % frappe.db.escape(txt), 'txt': "%%%s%%" % frappe.db.escape(txt),
'_txt': txt.replace("%", ""), '_txt': txt.replace("%", ""),
'start': start, 'start': start or 0,
'page_len': page_len 'page_len': page_len or 20
}) })
def get_project_name(doctype, txt, searchfield, start, page_len, filters): def get_project_name(doctype, txt, searchfield, start, page_len, filters):

View File

@ -161,18 +161,15 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) {
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) / tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) /
cint(doc.total_working_days)*100)/100; cint(doc.total_working_days)*100)/100;
refresh_field('amount', tbl[i].name, 'earnings');
} else if(reset_amount) { } else if(reset_amount) {
tbl[i].amount = tbl[i].default_amount; tbl[i].amount = tbl[i].default_amount;
refresh_field('amount', tbl[i].name, 'earnings');
} }
if(!tbl[i].do_not_include_in_total) { if(!tbl[i].do_not_include_in_total) {
total_earn += flt(tbl[i].amount); total_earn += flt(tbl[i].amount);
} }
} }
doc.gross_pay = total_earn; doc.gross_pay = total_earn;
refresh_many(['amount','gross_pay']); refresh_many(['earnings', 'amount','gross_pay']);
} }
// Calculate deduction total // Calculate deduction total
@ -183,17 +180,15 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) {
for(var i = 0; i < tbl.length; i++){ for(var i = 0; i < tbl.length; i++){
if(cint(tbl[i].depends_on_lwp) == 1) { if(cint(tbl[i].depends_on_lwp) == 1) {
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100; tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100;
refresh_field('amount', tbl[i].name, 'deductions');
} else if(reset_amount) { } else if(reset_amount) {
tbl[i].amount = tbl[i].default_amount; tbl[i].amount = tbl[i].default_amount;
refresh_field('amount', tbl[i].name, 'deductions');
} }
if(!tbl[i].do_not_include_in_total) { if(!tbl[i].do_not_include_in_total) {
total_ded += flt(tbl[i].amount); total_ded += flt(tbl[i].amount);
} }
} }
doc.total_deduction = total_ded; doc.total_deduction = total_ded;
refresh_field('total_deduction'); refresh_many(['deductions', 'total_deduction']);
} }
// Calculate net payable amount // Calculate net payable amount

View File

@ -348,7 +348,8 @@ class SalarySlip(TransactionBase):
/ cint(self.total_working_days)), self.precision("amount", component_type) / cint(self.total_working_days)), self.precision("amount", component_type)
) )
elif not self.payment_days and not self.salary_slip_based_on_timesheet: elif not self.payment_days and not self.salary_slip_based_on_timesheet and \
cint(d.depends_on_lwp):
d.amount = 0 d.amount = 0
elif not d.amount: elif not d.amount:
d.amount = d.default_amount d.amount = d.default_amount

View File

@ -990,18 +990,18 @@ class POSItems {
} }
this.get_items({search_value: search_term, item_group }) this.get_items({search_value: search_term, item_group })
.then(({ items, serial_no, batch_no }) => { .then(({ items, serial_no, batch_no, barcode }) => {
if (search_term) { if (search_term) {
this.search_index[search_term] = items; this.search_index[search_term] = items;
} }
this.items = items; this.items = items;
this.render_items(items); this.render_items(items);
this.set_item_in_the_cart(items, serial_no, batch_no); this.set_item_in_the_cart(items, serial_no, batch_no, barcode);
}); });
} }
set_item_in_the_cart(items, serial_no, batch_no) { set_item_in_the_cart(items, serial_no, batch_no, barcode) {
if (serial_no) { if (serial_no) {
this.events.update_cart(items[0].item_code, this.events.update_cart(items[0].item_code,
'serial_no', serial_no); 'serial_no', serial_no);
@ -1016,7 +1016,7 @@ class POSItems {
return; return;
} }
if (items.length === 1) { if (items.length === 1 && (serial_no || batch_no || barcode)) {
this.events.update_cart(items[0].item_code, this.events.update_cart(items[0].item_code,
'qty', '+1'); 'qty', '+1');
this.reset_search_field(); this.reset_search_field();

View File

@ -67,6 +67,11 @@ def get_items(start, page_length, price_list, item_group, search_value=""):
'batch_no': batch_no 'batch_no': batch_no
}) })
if barcode:
res.update({
'barcode': barcode
})
return res return res
def get_conditions(item_code, serial_no, batch_no, barcode): def get_conditions(item_code, serial_no, batch_no, barcode):