Skip to content

Commit

Permalink
Merge branch 'hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinhait committed Jan 17, 2017
2 parents 2bbf784 + aff2b94 commit b70767b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 21 deletions.
2 changes: 1 addition & 1 deletion erpnext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe

__version__ = '7.2.12'
__version__ = '7.2.13'

def get_default_company(user=None):
'''Get default company for user'''
Expand Down
5 changes: 3 additions & 2 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,7 @@
"in_standard_filter": 0,
"label": "Sales Invoice Payment",
"length": 0,
"no_copy": 0,
"no_copy": 1,
"options": "Sales Invoice Payment",
"permlevel": 0,
"precision": "",
Expand Down Expand Up @@ -3188,6 +3188,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Status",
"length": 0,
"no_copy": 1,
Expand Down Expand Up @@ -4182,7 +4183,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-11-09 14:18:24.760263",
"modified": "2017-01-17 11:07:25.814402",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
Expand Down
10 changes: 6 additions & 4 deletions erpnext/controllers/taxes_and_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,12 @@ def calculate_outstanding_amount(self):

def calculate_paid_amount(self):
paid_amount = base_paid_amount = 0.0
for payment in self.doc.get('payments'):
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
paid_amount += payment.amount
base_paid_amount += payment.base_amount

if self.doc.is_pos:
for payment in self.doc.get('payments'):
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
paid_amount += payment.amount
base_paid_amount += payment.base_amount

self.doc.paid_amount = flt(paid_amount, self.doc.precision("paid_amount"))
self.doc.base_paid_amount = flt(base_paid_amount, self.doc.precision("base_paid_amount"))
Expand Down
4 changes: 1 addition & 3 deletions erpnext/hr/doctype/process_payroll/process_payroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,8 @@ def set_start_end_dates(self):
@frappe.whitelist()
def get_start_end_dates(payroll_frequency, start_date=None):
'''Returns dict of start and end dates for given payroll frequency based on start_date'''
if not payroll_frequency:
frappe.throw(_("Please set Payroll Frequency first"))

if payroll_frequency == "Monthly" or payroll_frequency == "Bimonthly":
if payroll_frequency == "Monthly" or payroll_frequency == "Bimonthly" or payroll_frequency == "":
fiscal_year = get_fiscal_year(start_date)[0]
month = "%02d" % getdate(start_date).month
m = get_month_details(fiscal_year, month)
Expand Down
25 changes: 22 additions & 3 deletions erpnext/projects/doctype/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from frappe import _

from frappe.model.document import Document
from erpnext.controllers.queries import get_filters_cond
from frappe.desk.reportview import get_match_cond

class Project(Document):
def get_feed(self):
Expand Down Expand Up @@ -215,12 +217,29 @@ def get_list_context(context=None):
}

def get_users_for_project(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select name, concat_ws(' ', first_name, middle_name, last_name)
conditions = []
return frappe.db.sql("""select name, concat_ws(' ', first_name, middle_name, last_name)
from `tabUser`
where enabled=1
and name not in ("Guest", "Administrator")
and name not in ("Guest", "Administrator")
and ({key} like %(txt)s
or full_name like %(txt)s)
{fcond} {mcond}
order by
name asc""")
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, full_name), locate(%(_txt)s, full_name), 99999),
idx desc,
name, full_name
limit %(start)s, %(page_len)s""".format(**{
'key': searchfield,
'fcond': get_filters_cond(doctype, filters, conditions),
'mcond': get_match_cond(doctype)
}), {
'txt': "%%%s%%" % txt,
'_txt': txt.replace("%", ""),
'start': start,
'page_len': page_len
})

@frappe.whitelist()
def get_cost_center_name(project):
Expand Down
12 changes: 7 additions & 5 deletions erpnext/public/js/controllers/taxes_and_totals.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,13 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
calculate_paid_amount: function(){
var me = this;
var paid_amount = base_paid_amount = 0.0;
$.each(this.frm.doc['payments'] || [], function(index, data){
data.base_amount = flt(data.amount * me.frm.doc.conversion_rate, precision("base_amount"));
paid_amount += data.amount;
base_paid_amount += data.base_amount;
})
if(this.frm.doc.is_pos) {
$.each(this.frm.doc['payments'] || [], function(index, data){
data.base_amount = flt(data.amount * me.frm.doc.conversion_rate, precision("base_amount"));
paid_amount += data.amount;
base_paid_amount += data.base_amount;
})
}

this.frm.doc.paid_amount = flt(paid_amount, precision("paid_amount"));
this.frm.doc.base_paid_amount = flt(base_paid_amount, precision("base_paid_amount"));
Expand Down
6 changes: 3 additions & 3 deletions erpnext/stock/doctype/stock_entry/stock_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ def set_actual_qty(self):

# validate qty during submit
if d.docstatus==1 and d.s_warehouse and not allow_negative_stock and d.actual_qty < d.transfer_qty:
frappe.throw(_("Row {0}: Qty not available for {4} in warehouse {1} at posting time of the entry ({2} {3})".format(d.idx,
frappe.throw(_("Row {0}: Qty not available for {4} in warehouse {1} at posting time of the entry ({2} {3})").format(d.idx,
frappe.bold(d.s_warehouse), formatdate(self.posting_date),
format_time(self.posting_time), frappe.bold(d.item_code)))
format_time(self.posting_time), frappe.bold(d.item_code))
+ '<br><br>' + _("Available qty is {0}, you need {1}").format(frappe.bold(d.actual_qty),
frappe.bold(d.transfer_qty)),
NegativeStockError, title=_('Insufficient Stock'))
Expand Down Expand Up @@ -867,4 +867,4 @@ def get_warehouse_details(args):
"basic_rate" : get_incoming_rate(args)
}

return ret
return ret

0 comments on commit b70767b

Please sign in to comment.