Merge branch 'master' of git://github.com/akhileshdarjee/erpnext into akhileshdarjee-master

Conflicts:
	accounts/doctype/pos_setting/pos_setting.txt
	patches/patch_list.py
This commit is contained in:
Anand Doshi 2013-08-12 20:00:33 +05:30
commit 9e59aff54e
4 changed files with 55 additions and 4 deletions

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 12:15:51",
"docstatus": 0,
"modified": "2013-08-09 14:45:28",
"modified": "2013-08-09 16:35:03",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -131,12 +131,12 @@
},
{
"doctype": "DocField",
"fieldname": "customer_account",
"fieldname": "customer",
"fieldtype": "Link",
"label": "Customer Account",
"label": "Customer",
"oldfieldname": "customer_account",
"oldfieldtype": "Link",
"options": "Account",
"options": "Customer",
"read_only": 0,
"reqd": 0
},

View File

@ -45,6 +45,7 @@ class DocType:
if self.doc.user_id:
self.update_user_default()
self.update_profile()
self.update_dob_event()
def update_user_default(self):
webnotes.conn.set_default("employee", self.doc.name, self.doc.user_id)
@ -154,6 +155,31 @@ class DocType:
msgprint(_("Invalid Leave Approver") + ": \"" + l.leave_approver + "\"",
raise_exception=InvalidLeaveApproverError)
def update_dob_event(self):
get_events = webnotes.conn.sql("""select name from `tabEvent` where repeat_on='Every Year'
and ref_type='Employee' and ref_name=%s""", (self.doc.name), as_dict=1)
starts_on = self.doc.date_of_birth + " 00:00:00"
ends_on = self.doc.date_of_birth + " 00:15:00"
if get_events:
webnotes.conn.sql("""update `tabEvent` set starts_on=%s, ends_on=%s
where name=%s""", (get_events[0].name, starts_on, ends_on)
else:
event_wrapper = webnotes.bean({
"doctype": "Event",
"subject": _("Birthday") + ": " + self.doc.employee_name,
"starts_on": starts_on,
"ends_on": ends_on,
"event_type": "Public",
"all_day": 1,
"send_reminder": 1,
"repeat_this_event": 1,
"repeat_on": "Every Year",
"ref_type": "Employee",
"ref_name": self.doc.name
}).insert()
@webnotes.whitelist()
def get_retirement_date(date_of_birth=None):
import datetime

View File

@ -0,0 +1,24 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("accounts", "doctype", "pos_setting")
if "customer_account" in webnotes.conn.get_table_columns("POS Setting"):
customer_account = webnotes.conn.sql("""select customer_account, name from `tabPOS Setting`
where ifnull(customer_account, '')!=''""")
for cust_acc, pos_name in customer_account:
customer = webnotes.conn.sql("""select master_name, account_name from `tabAccount`
where name=%s""", (cust_acc), as_dict=1)
if not customer[0].master_name:
customer_name = webnotes.conn.get_value('Customer', customer[0].account_name, 'name')
else:
customer_name = customer[0].master_name
webnotes.conn.set_value('POS Setting', pos_name, 'customer', customer_name)
webnotes.conn.sql_ddl("""alter table `tabPOS Setting` drop column `customer_account`""")

View File

@ -253,4 +253,5 @@ patch_list = [
"execute:webnotes.bean('Selling Settings').save() #2013-07-29",
"patches.august_2013.p01_hr_settings",
"patches.august_2013.p02_rename_price_list",
"patches.august_2013.p03_pos_setting_replace_customer_account",
]