[git fixes] salary manager, time log title, notificaitons

This commit is contained in:
Rushabh Mehta 2015-02-26 15:01:23 +05:30
parent e693f794f5
commit 2cc585f180
15 changed files with 97 additions and 70 deletions

View File

@ -72,6 +72,7 @@
"permlevel": 0
},
{
"depends_on": "eval: doc.buying || doc.selling",
"fieldname": "applicable_for",
"fieldtype": "Select",
"label": "Applicable For",
@ -244,7 +245,7 @@
"icon": "icon-gift",
"idx": 1,
"istable": 0,
"modified": "2015-02-05 05:11:42.530822",
"modified": "2015-02-26 04:26:13.240166",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Pricing Rule",

View File

@ -48,7 +48,8 @@ class SellingController(StockController):
def set_missing_lead_customer_details(self):
if getattr(self, "customer", None):
from erpnext.accounts.party import _get_party_details
party_details = _get_party_details(self.customer, ignore_permissions=self.flags.ignore_permissions)
party_details = _get_party_details(self.customer,
ignore_permissions=self.flags.ignore_permissions)
if not self.meta.get_field("sales_team"):
party_details.pop("sales_team")

View File

@ -157,6 +157,7 @@ def get_item_details(item_code):
def make_quotation(source_name, target_doc=None):
def set_missing_values(source, target):
quotation = frappe.get_doc(target)
quotation.currency = None # set it as default from customer
quotation.run_method("set_missing_values")
quotation.run_method("calculate_taxes_and_totals")

View File

@ -1,4 +1,4 @@
# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals

View File

@ -1,4 +1,4 @@
# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals

View File

@ -5,7 +5,7 @@ var display_activity_log = function(msg) {
if(!cur_frm.ss_html)
cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
cur_frm.ss_html.innerHTML =
'<div class="panel"><div class="panel-heading">'+__("Activity Log:")+'</div>'+msg+'</div>';
'<div class="padding"><h4>'+__("Activity Log:")+'</h4>'+msg+'</div>';
}
//Create salary slip
@ -38,25 +38,8 @@ cur_frm.cscript.make_bank_entry = function(doc,cdt,cdn){
}
cur_frm.cscript.make_jv = function(doc, dt, dn) {
var call_back = function(r, rt){
var jv = frappe.model.make_new_doc_and_get_name('Journal Entry');
jv = locals['Journal Entry'][jv];
jv.voucher_type = 'Bank Entry';
jv.user_remark = __('Payment of salary for the month {0} and year {1}', [doc.month, doc.fiscal_year]);
jv.fiscal_year = doc.fiscal_year;
jv.company = doc.company;
jv.posting_date = dateutil.obj_to_str(new Date());
// credit to bank
var d1 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts');
d1.account = r.message['default_bank_account'];
d1.credit = r.message['amount']
// debit to salary account
var d2 = frappe.model.add_child(jv, 'Journal Entry Account', 'accounts');
d2.debit = r.message['amount']
loaddoc('Journal Entry', jv.name);
}
return $c_obj(doc, 'get_acc_details', '', call_back);
return $c_obj(doc, 'make_journal_entry', '', function(r) {
var doc = frappe.model.sync(r.message)[0];
frappe.set_route("Form", doc.doctype, doc.name);
});
}

View File

@ -7,16 +7,10 @@
"doctype": "DocType",
"document_type": "Other",
"fields": [
{
"fieldname": "document_description",
"fieldtype": "HTML",
"label": "Document Description",
"options": "<div class=\"alert alert-info\">You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here</div>",
"permlevel": 0
},
{
"fieldname": "section_break0",
"fieldtype": "Section Break",
"label": "Select Employees",
"permlevel": 0
},
{
@ -42,6 +36,19 @@
"options": "Branch",
"permlevel": 0
},
{
"description": "Check if you want to send salary slip in mail to each employee while submitting salary slip",
"fieldname": "send_email",
"fieldtype": "Check",
"label": "Send Email",
"permlevel": 0
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
{
"fieldname": "department",
"fieldtype": "Link",
@ -57,10 +64,11 @@
"permlevel": 0
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"fieldname": "select_payroll_year_and_month",
"fieldtype": "Section Break",
"label": "Select Payroll Year and Month",
"permlevel": 0,
"width": "50%"
"precision": ""
},
{
"fieldname": "fiscal_year",
@ -70,6 +78,12 @@
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "column_break_11",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "month",
"fieldtype": "Select",
@ -79,16 +93,11 @@
"reqd": 1
},
{
"description": "Check if you want to send salary slip in mail to each employee while submitting salary slip",
"fieldname": "send_email",
"fieldtype": "Check",
"label": "Send Email",
"permlevel": 0
},
{
"fieldname": "section_break1",
"fieldname": "process_payroll",
"fieldtype": "Section Break",
"permlevel": 0
"label": "Process Payroll",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "column_break2",
@ -144,7 +153,7 @@
"icon": "icon-cog",
"idx": 1,
"issingle": 1,
"modified": "2015-02-05 05:11:44.876131",
"modified": "2015-02-25 07:21:04.778082",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Manager",

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, flt
from frappe.utils import cint, flt, nowdate
from frappe import _
from frappe.model.document import Document
@ -75,7 +75,6 @@ class SalaryManager(Document):
def create_sal_slip(self):
"""
Creates salary slip for selected employees if already not created
"""
emp_list = self.get_emp_list()
@ -99,9 +98,9 @@ class SalaryManager(Document):
def create_log(self, ss_list):
log = "<b>No employee for the above selected criteria OR salary slip already created</b>"
log = "<p>No employee for the above selected criteria OR salary slip already created</p>"
if ss_list:
log = "<b>Created Salary Slip has been created: </b>\
log = "<b>Salary Slip Created For</b>\
<br><br>%s" % '<br>'.join(ss_list)
return log
@ -149,7 +148,7 @@ class SalaryManager(Document):
if submitted_ss:
mail_sent_msg = self.send_email and " (Mail has been sent to the employee)" or ""
log = """
<b>Submitted Salary Slips%s:</b>\
<b>Salary Slips Submitted %s:</b>\
<br><br> %s <br><br>
""" % (mail_sent_msg, '<br>'.join(submitted_ss))
@ -179,17 +178,27 @@ class SalaryManager(Document):
return flt(tot[0][0])
def get_acc_details(self):
"""
get default bank account,default salary acount from company
"""
amt = self.get_total_salary()
def make_journal_entry(self, salary_account = None):
amount = self.get_total_salary()
default_bank_account = frappe.db.get_value("Company", self.company,
"default_bank_account")
if not default_bank_account:
frappe.msgprint(_("You can set Default Bank Account in Company master"))
return {
'default_bank_account' : default_bank_account,
'amount' : amt
}
journal_entry = frappe.new_doc('Journal Entry')
journal_entry.voucher_type = 'Bank Entry'
journal_entry.user_remark = _('Payment of salary for the month {0} and year {1}').format(self.month,
self.fiscal_year)
journal_entry.fiscal_year = self.fiscal_year
journal_entry.company = self.company
journal_entry.posting_date = nowdate()
journal_entry.set("accounts", [
{
"account": salary_account,
"debit": amount
},
{
"account": default_bank_account,
"credit": amount
},
])
return journal_entry.as_dict()

View File

@ -351,7 +351,7 @@
"idx": 1,
"in_create": 0,
"is_submittable": 1,
"modified": "2015-02-25 01:01:11.550217",
"modified": "2015-02-26 04:03:28.164713",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order",
@ -380,5 +380,6 @@
"report": 1,
"role": "Material User"
}
]
],
"title_field": "production_item"
}

View File

@ -130,3 +130,4 @@ erpnext.patches.v5_0.update_from_bom
erpnext.patches.v5_0.update_account_types
erpnext.patches.v5_0.update_sms_sender
erpnext.patches.v5_0.set_appraisal_remarks
erpnext.patches.v5_0.update_time_log_title

View File

@ -1,4 +1,4 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals

View File

@ -1,3 +1,7 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():

View File

@ -1,4 +1,4 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals

View File

@ -229,12 +229,20 @@
"permlevel": 1,
"print_hide": 1,
"read_only": 0
},
{
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"permlevel": 0,
"precision": ""
}
],
"icon": "icon-time",
"idx": 1,
"is_submittable": 1,
"modified": "2015-02-24 03:57:27.652685",
"modified": "2015-02-26 02:22:10.312376",
"modified_by": "Administrator",
"module": "Projects",
"name": "Time Log",
@ -271,5 +279,5 @@
"write": 1
}
],
"title_field": "activity_type"
"title_field": "title"
}

View File

@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
@ -19,6 +17,7 @@ from frappe.model.document import Document
class TimeLog(Document):
def validate(self):
self.set_status()
self.set_title()
self.validate_overlap()
self.validate_timings()
self.calculate_total_hours()
@ -53,6 +52,16 @@ class TimeLog(Document):
if self.sales_invoice:
self.status="Billed"
def set_title(self):
if self.production_order:
self.title = _("{0} for {1}").format(self.operation, self.production_order)
elif self.task:
self.title = _("{0} for {1}").format(self.activity_type, self.task)
elif self.project:
self.title = _("{0} for {1}").format(self.activity_type, self.project)
else:
self.title = self.activity_type
def validate_overlap(self):
"""Checks if 'Time Log' entries overlap for a user, workstation. """
self.validate_overlap_for("user")