[minor] fixes

This commit is contained in:
Rushabh Mehta 2016-06-29 18:38:12 +05:30
parent 878dfec46a
commit 8c2e79cf0d
4 changed files with 33 additions and 25 deletions

View File

@ -88,8 +88,8 @@ class SalarySlip(TransactionBase):
if not struct:
self.salary_structure = None
msgprint(_("No active or default Salary Structure found for employee {0} and the month")
.format(self.employee))
frappe.throw(_("No active or default Salary Structure found for employee {0} for the given dates")
.format(self.employee), title=_('Salary Structure Missing'))
return struct and struct[0][0] or ''
@ -261,7 +261,7 @@ class SalarySlip(TransactionBase):
self.update_status(self.name)
if(frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee")):
self.email_salary_slip()
def on_cancel(self):
self.update_status()

View File

@ -16,15 +16,7 @@ class Project(Document):
def onload(self):
"""Load project tasks for quick view"""
if not self.get('__unsaved') and not self.get("tasks"):
for task in self.get_tasks():
self.append("tasks", {
"title": task.subject,
"status": task.status,
"start_date": task.exp_start_date,
"end_date": task.exp_end_date,
"description": task.description,
"task_id": task.name
})
self.load_tasks()
self.set_onload('links', self.meta.get_links_setup())
self.set_onload('activity_summary', frappe.db.sql('''select activity_type, sum(hours) as total_hours
@ -33,6 +25,19 @@ class Project(Document):
def __setup__(self):
self.onload()
def load_tasks(self):
"""Load `tasks` from the database"""
self.tasks = []
for task in self.get_tasks():
self.append("tasks", {
"title": task.subject,
"status": task.status,
"start_date": task.exp_start_date,
"end_date": task.exp_end_date,
"description": task.description,
"task_id": task.name
})
def get_tasks(self):
return frappe.get_all("Task", "*", {"project": self.name}, order_by="exp_start_date asc")

View File

@ -5,6 +5,7 @@ links = {
'non_standard_fieldnames': {
'Production Order': 'production_item',
'Product Bundle': 'new_item_code',
'BOM': 'item',
'Batch': 'item'
},
'transactions': [

View File

@ -1,17 +1,19 @@
{
"apply_user_permissions": 1,
"creation": "2013-08-20 15:08:10",
"docstatus": 0,
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2014-06-03 07:18:17.128919",
"modified_by": "Administrator",
"module": "Stock",
"name": "Items To Be Requested",
"owner": "Administrator",
"add_total_row": 0,
"apply_user_permissions": 1,
"creation": "2013-08-20 15:08:10",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2016-06-29 17:39:54.122679",
"modified_by": "Administrator",
"module": "Stock",
"name": "Items To Be Requested",
"owner": "Administrator",
"query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC",
"ref_doctype": "Item",
"report_name": "Items To Be Requested",
"ref_doctype": "Material Request",
"report_name": "Items To Be Requested",
"report_type": "Query Report"
}