Merge pull request #4751 from agusputra/patch-11
Update calendar.md
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index d6d8822..b60561c 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -52,6 +52,8 @@
frappe.throw(_("Clearance date cannot be before check date in row {0}").format(d.idx))
if d.clearance_date or self.include_reconciled_entries:
+ if not d.clearance_date:
+ d.clearance_date = None
frappe.db.set_value("Journal Entry", d.voucher_id, "clearance_date", d.clearance_date)
frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s
where name=%s""", (d.clearance_date, nowdate(), d.voucher_id))
diff --git a/erpnext/docs/user/manual/en/manufacturing/production-order.md b/erpnext/docs/user/manual/en/manufacturing/production-order.md
index 5ded4f9..1720db9 100644
--- a/erpnext/docs/user/manual/en/manufacturing/production-order.md
+++ b/erpnext/docs/user/manual/en/manufacturing/production-order.md
@@ -28,7 +28,7 @@
<img class="screenshot" alt="PO Opeartions" src="{{docs_base_url}}/assets/img/manufacturing/PO-operations.png">
-* If you wish to reassign the wrokstation for a particular opeeration in the Production Order, you can do so before submitting the Production Order.
+* If you wish to reassign the workstation for a particular opeeration in the Production Order, you can do so before submitting the Production Order.
<img class="screenshot" alt="PO reassigning Operations" src="{{docs_base_url}}/assets/img/manufacturing/PO-reassigning-operations.png">
@@ -101,6 +101,4 @@
> Note : In order to make a Production Order against an Item you must specify 'Yes' to "Allow Production Order" on the Item form.
-> Note : In order to make a Production Order against an Item you must specify 'Yes' to "Allow Production Order" on the Item form.
-
{next}
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 85cd38d..c486391 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -95,11 +95,11 @@
if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
cur_frm.savesubmit();
- if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") &&
+ if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") && doc.approval_status=="Approved" &&
cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount))
- cur_frm.add_custom_button(__("Bank Entry"),
- cur_frm.cscript.make_bank_entry, __("Make"));
- cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
+ cur_frm.add_custom_button(__("Bank Entry"),
+ cur_frm.cscript.make_bank_entry, __("Make"));
+ cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
}
}
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index fe1291f..9e638cc 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -133,7 +133,7 @@
if not self.name:
self.name = "New Leave Application"
- for d in frappe.db.sql("""select name, leave_type, posting_date, from_date, to_date
+ for d in frappe.db.sql("""select name, leave_type, posting_date, from_date, to_date, total_leave_days
from `tabLeave Application`
where employee = %(employee)s and docstatus < 2 and status in ("Open", "Approved")
and to_date >= %(from_date)s and from_date <= %(to_date)s
@@ -144,12 +144,29 @@
"name": self.name
}, as_dict = 1):
- frappe.msgprint(_("Employee {0} has already applied for {1} between {2} and {3}")
- .format(self.employee, cstr(d['leave_type']),
- formatdate(d['from_date']), formatdate(d['to_date'])))
+ if d['total_leave_days']==0.5 and cint(self.half_day)==1:
+ sum_leave_days=frappe.db.sql("""select sum(total_leave_days) from `tabLeave Application`
+ where employee = %(employee)s
+ and docstatus < 2
+ and status in ("Open", "Approved")
+ and (from_date between %(from_date)s and %(to_date)s
+ or to_date between %(from_date)s and %(to_date)s
+ or %(from_date)s between from_date and to_date)
+ and name != %(name)s""", {
+ "employee": self.employee,
+ "from_date": self.from_date,
+ "to_date": self.to_date,
+ "name": self.name
+ })[0][0]
+ if sum_leave_days==1:
+ frappe.msgprint(_("Employee {0} has already applied this day").format(self.employee))
+ frappe.throw('<a href="#Form/Leave Application/{0}">{0}</a>'.format(d["name"]), OverlapError)
+ else:
+ frappe.msgprint(_("Employee {0} has already applied for {1} between {2} and {3}")
+ .format(self.employee, cstr(d['leave_type']),formatdate(d['from_date']), formatdate(d['to_date'])))
- frappe.throw("""Exising Application: <a href="#Form/Leave Application/{0}">{0}</a>"""
- .format(d["name"]), OverlapError)
+ frappe.throw("""Exising Application: <a href="#Form/Leave Application/{0}">{0}</a>""".format(d["name"]), OverlapError)
+
def validate_max_days(self):
max_days = frappe.db.get_value("Leave Type", self.leave_type, "max_days_allowed")
@@ -311,7 +328,7 @@
and h1.holiday_date between %s and %s""", (employee, from_date, to_date))[0][0]
if not tot_hol:
- tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2
+ tot_hol = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
where h1.parent = h2.name and h1.holiday_date between %s and %s
and h2.is_default = 1""", (from_date, to_date))[0][0]
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index 3bc355c..d7787b5 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -26,8 +26,8 @@
total_p = total_a = 0.0
for day in range(filters["total_days_in_month"]):
- status = att_map.get(emp).get(day + 1, "Absent")
- status_map = {"Present": "P", "Absent": "A", "Half Day": "H"}
+ status = att_map.get(emp).get(day + 1, "None")
+ status_map = {"Present": "P", "Absent": "A", "Half Day": "H", "None":" "}
row.append(status_map[status])
if status == "Present":
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index b8d9f04..58c68e8 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -243,7 +243,7 @@
company: function() {
var me = this;
- var fn = function() {
+ var set_pricing = function() {
if(me.frm.doc.company && me.frm.fields_dict.currency) {
var company_currency = me.get_company_currency();
var company_doc = frappe.get_doc(":Company", me.frm.doc.company);
@@ -270,10 +270,40 @@
me.apply_pricing_rule();
}
}
+
+ var set_party_account = function(set_pricing) {
+ if (in_list(["Sales Invoice", "Purchase Invoice"], me.frm.doc.doctype)) {
+ if(me.frm.doc.doctype=="Sales Invoice") {
+ var party_type = "Customer";
+ var party_account_field = 'debit_to';
+ } else {
+ var party_type = "Supplier";
+ var party_account_field = 'credit_to';
+ }
+
+ return frappe.call({
+ method: "erpnext.accounts.party.get_party_account",
+ args: {
+ company: me.frm.doc.company,
+ party_type: party_type,
+ party: me.frm.doc[frappe.model.scrub(party_type)]
+ },
+ callback: function(r) {
+ if(!r.exc && r.message) {
+ me.frm.set_value(party_account_field, r.message);
+ set_pricing();
+ }
+ }
+ });
+ } else {
+ set_pricing();
+ }
+
+ }
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
else var date = this.frm.doc.transaction_date;
- erpnext.get_fiscal_year(this.frm.doc.company, date, fn);
+ erpnext.get_fiscal_year(this.frm.doc.company, date, function() { set_party_account(set_pricing); });
if(this.frm.doc.company) {
erpnext.last_selected_company = this.frm.doc.company;
diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js
index 6d02d0d..8bae546 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.js
+++ b/erpnext/setup/doctype/sales_person/sales_person.js
@@ -27,12 +27,6 @@
}
}
-cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
- return {
- filters: { 'is_group': "No" }
- }
-}
-
cur_frm.fields_dict.employee.get_query = function(doc, cdt, cdn) {
return { query: "erpnext.controllers.queries.employee_query" }
}
diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js
index 2beeceb..cde04b3 100644
--- a/erpnext/setup/doctype/territory/territory.js
+++ b/erpnext/setup/doctype/territory/territory.js
@@ -25,12 +25,4 @@
['Territory', 'name', '!=', doc.territory_name]
]
}
-}
-
-
-// ******************** ITEM Group ********************************
-cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
- return{
- filters:{ 'is_group': "No"}
- }
-}
+}
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 92e7adf..7d82da1 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -35,11 +35,25 @@
def get_columns(filters):
"""return columns based on filters"""
- columns = ["Item:Link/Item:100", "Item Name::150", "Item Group::100", "Brand::90", \
- "Description::140", "Warehouse:Link/Warehouse:100", "Stock UOM:Link/UOM:90", "Opening Qty:Float:100", \
- "Opening Value:Float:110", "In Qty:Float:80", "In Value:Float:80", "Out Qty:Float:80", \
- "Out Value:Float:80", "Balance Qty:Float:100", "Balance Value:Float:100", \
- "Valuation Rate:Float:90", "Company:Link/Company:100"]
+ columns = [
+ _("Item")+":Link/Item:100",
+ _("Item Name")+"::150",
+ _("Item Group")+"::100",
+ _("Brand")+"::90",
+ _("Description")+"::140",
+ _("Warehouse")+":Link/Warehouse:100",
+ _("Stock UOM")+":Link/UOM:90",
+ _("Opening Qty")+":Float:100",
+ _("Opening Value")+":Float:110",
+ _("In Qty")+":Float:80",
+ _("In Value")+":Float:80",
+ _("Out Qty")+":Float:80",
+ _("Out Value")+":Float:80",
+ _("Balance Qty")+":Float:100",
+ _("Balance Value")+":Float:100",
+ _("Valuation Rate")+":Float:90",
+ _("Company")+":Link/Company:100"
+ ]
return columns