Merge branch 'master' of github.com:webnotes/erpnext into comm_log

Conflicts:
	erpnext/selling/doctype/lead/lead.js
	erpnext/setup/doctype/contact_control/contact_control.js
This commit is contained in:
Anand Doshi 2012-06-05 18:37:17 +05:30
commit dbb84a271e
39 changed files with 516 additions and 543 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -52,7 +52,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.hide_unhide_group_ledger = function(doc) { cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
hide_field(['convert_to_group', 'convert_to_ledger']); hide_field(['convert_to_group', 'convert_to_ledger']);
if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger'); if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_ledger'); else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group');
} }
// Convert group to ledger // Convert group to ledger

View File

@ -485,7 +485,8 @@ def manage_recurring_invoices():
and notify the concerned people and notify the concerned people
""" """
rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0) = 1 rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0) = 1
and next_date = %s and next_date <= end_date and docstatus=1 order by next_date desc""", nowdate()) and next_date = %s and next_date <= ifnull(end_date, '2199-12-31') and docstatus=1""", nowdate())
for d in rv: for d in rv:
if not webnotes.conn.sql("""select name from `tabSales Invoice` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])): if not webnotes.conn.sql("""select name from `tabSales Invoice` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
prev_rv = get_obj('Sales Invoice', d[0], with_children=1) prev_rv = get_obj('Sales Invoice', d[0], with_children=1)
@ -503,6 +504,8 @@ def create_new_invoice(prev_rv):
new_rv.doc.posting_date = new_rv.doc.next_date new_rv.doc.posting_date = new_rv.doc.next_date
new_rv.doc.aging_date = new_rv.doc.next_date new_rv.doc.aging_date = new_rv.doc.next_date
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date))) new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
new_rv.doc.invoice_period_from_date = get_next_month_date(new_rv.doc.invoice_period_from_date)
new_rv.doc.invoice_period_to_date = get_next_month_date(new_rv.doc.invoice_period_to_date)
new_rv.doc.owner = prev_rv.doc.owner new_rv.doc.owner = prev_rv.doc.owner
new_rv.doc.save() new_rv.doc.save()
@ -512,6 +515,21 @@ def create_new_invoice(prev_rv):
return new_rv return new_rv
def get_next_month_date(dt):
import datetime
m = getdate(dt).month + 1
y = getdate(dt).year
d = getdate(dt).day
if m > 12:
m, y = 1, y+1
try:
next_month_date = datetime.date(y, m, d)
except:
import calendar
last_day = calendar.monthrange(y, m)[1]
next_month_date = datetime.date(y, m, last_day)
return next_month_date.strftime("%Y-%m-%d")
def send_notification(new_rv): def send_notification(new_rv):
"""Notify concerned persons about recurring invoice generation""" """Notify concerned persons about recurring invoice generation"""
@ -528,7 +546,7 @@ def send_notification(new_rv):
</tr> </tr>
</table> </table>
''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \ ''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \
getdate(add_days(add_months(new_rv.doc.posting_date, -1), 1)).strftime("%d-%m-%Y"), getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"),\ getdate(new_rv.doc.invoice_period_from_date).strftime("%d-%m-%Y"), getdate(new_rv.doc.invoice_period_to_date).strftime("%d-%m-%Y"),\
getdate(new_rv.doc.due_date).strftime("%d-%m-%Y")) getdate(new_rv.doc.due_date).strftime("%d-%m-%Y"))
@ -570,5 +588,4 @@ def send_notification(new_rv):
msg = hd + tbl + totals msg = hd + tbl + totals
from webnotes.utils.email_lib import sendmail from webnotes.utils.email_lib import sendmail
sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \ sendmail(new_rv.doc.notification_email_address.split(", "), subject=subject, msg = msg)
sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:35:46', 'creation': '2012-04-13 11:56:17',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 14:45:49', 'modified': '2012-05-31 11:38:17',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'jai@webnotestech.com' 'owner': u'jai@webnotestech.com'
}, },
@ -24,7 +24,7 @@
'section_style': u'Simple', 'section_style': u'Simple',
'server_code_error': u' ', 'server_code_error': u' ',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 123 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -94,6 +94,20 @@
'role': u'Accounts Manager' 'role': u'Accounts Manager'
}, },
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'System Manager'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts Manager'
},
# DocPerm # DocPerm
{ {
'amend': 1, 'amend': 1,
@ -117,20 +131,6 @@
'write': 1 'write': 1
}, },
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'System Manager'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts Manager'
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -238,6 +238,17 @@
'trigger': u'Client' 'trigger': u'Client'
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'coa_help',
'fieldtype': u'HTML',
'label': u'CoA Help',
'oldfieldtype': u'HTML',
'options': u'<a href="#!Accounts Browser/Account">To manage Account Head, click here</a>',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',

View File

@ -292,7 +292,7 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
// Expense Head // Expense Head
// ------------- // -------------
cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) { cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'; return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
} }
cur_frm.cscript.expense_head = function(doc, cdt, cdn){ cur_frm.cscript.expense_head = function(doc, cdt, cdn){
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];

View File

@ -127,7 +127,7 @@ class DocType(TransactionBase):
def get_pv_details(self, arg): def get_pv_details(self, arg):
import json import json
item_det = sql("select item_name, brand, description, item_group, purchase_account, cost_center from tabItem where name=%s",arg,as_dict=1) item_det = sql("select item_name, brand, description, item_group, purchase_account, cost_center, stock_uom from tabItem where name=%s",arg,as_dict=1)
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg) tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
t = {} t = {}
@ -146,7 +146,8 @@ class DocType(TransactionBase):
'discount_rate': 0.00, 'discount_rate': 0.00,
'expense_head': item_det and item_det[0]['purchase_account'] or '', 'expense_head': item_det and item_det[0]['purchase_account'] or '',
'cost_center': item_det and item_det[0]['cost_center'] or '', 'cost_center': item_det and item_det[0]['cost_center'] or '',
'item_tax_rate': json.dumps(t) 'item_tax_rate': json.dumps(t),
'uom': item_det and item_det[0]['stock_uom'] or ''
} }
# get last purchase rate # get last purchase rate

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:35:46', 'creation': '2012-04-13 11:56:17',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 14:35:46', 'modified': '2012-06-04 12:10:22',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -22,7 +22,7 @@
'section_style': u'Tray', 'section_style': u'Tray',
'server_code_error': u' ', 'server_code_error': u' ',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 46 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -229,6 +229,17 @@
'print_hide': 1 'print_hide': 1
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'uom',
'fieldtype': u'Link',
'label': u'UOM',
'options': u'UOM',
'permlevel': 0,
'print_hide': 1
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',

View File

@ -390,7 +390,7 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
// Income Account in Details Table // Income Account in Details Table
// -------------------------------- // --------------------------------
cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) { cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) {
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'; return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Credit" OR tabAccount.account_type = "Income Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
} }
// warehouse in detail table // warehouse in detail table

View File

@ -508,28 +508,15 @@ class DocType(TransactionBase):
msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted") msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted")
raise Exception , "Validation Error." raise Exception , "Validation Error."
#Set Actual Qty based on item code and warehouse #Set Actual Qty based on item code and warehouse
#------------------------------------------------------ #------------------------------------------------------
def set_actual_qty(self): def set_actual_qty(self):
for d in getlist(self.doclist, 'delivery_note_details'): for d in getlist(self.doclist, 'entries'):
if d.item_code and d.warehouse: if d.item_code and d.warehouse:
actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse)) actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0 d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
# Check qty in stock depends on item code and warehouse
#-------------------------------------------------------
def check_qty_in_stock(self):
for d in getlist(self.doclist, 'entries'):
is_stock_item = webnotes.conn.sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0]
actual_qty = 0
if d.item_code and d.warehouse:
actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
if is_stock_item == 'Yes' and flt(d.qty) > flt(actual_qty):
msgprint("For Item: " + cstr(d.item_code) + " at Warehouse: " + cstr(d.warehouse) + " Quantity: " + cstr(d.qty) +" is not Available. (Must be less than or equal to " + cstr(actual_qty) + " )")
raise Exception, "Validation Error"
# ********************** Make Stock Entry ************************************ # ********************** Make Stock Entry ************************************
@ -569,7 +556,6 @@ class DocType(TransactionBase):
#-------------------POS Stock Updatation Part---------------------------------------------- #-------------------POS Stock Updatation Part----------------------------------------------
def pos_update_stock(self): def pos_update_stock(self):
self.check_qty_in_stock()
self.update_stock_ledger(update_stock = 1) self.update_stock_ledger(update_stock = 1)
# ********** Get Actual Qty of item in warehouse selected ************* # ********** Get Actual Qty of item in warehouse selected *************
@ -697,6 +683,8 @@ class DocType(TransactionBase):
def convert_into_recurring(self): def convert_into_recurring(self):
if self.doc.convert_into_recurring_invoice: if self.doc.convert_into_recurring_invoice:
if not self.doc.invoice_period_from_date or not self.doc.invoice_period_to_date:
msgprint("Invoice period from date and to date is mandatory for recurring invoice", raise_exception=1)
self.set_next_date() self.set_next_date()
if not self.doc.recurring_id: if not self.doc.recurring_id:
webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####')) webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))

View File

@ -5,7 +5,7 @@
{ {
'creation': '2012-04-13 11:56:18', 'creation': '2012-04-13 11:56:18',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-05-14 14:09:43', 'modified': '2012-06-04 14:40:59',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -1498,11 +1498,25 @@
{ {
'allow_on_submit': 1, 'allow_on_submit': 1,
'depends_on': u'eval:doc.convert_into_recurring_invoice==1', 'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
'description': u'The date on which recurring invoice will be stop', 'description': u'Start date of the invoice period',
'doctype': u'DocField', 'doctype': u'DocField',
'fieldname': u'end_date', 'fieldname': u'invoice_period_from_date',
'fieldtype': u'Date', 'fieldtype': u'Date',
'label': u'End Date', 'label': u'Invoice Period From Date',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'allow_on_submit': 1,
'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
'description': u'End date of the invoice period',
'doctype': u'DocField',
'fieldname': u'invoice_period_to_date',
'fieldtype': u'Date',
'label': u'Invoice Period To Date',
'no_copy': 1, 'no_copy': 1,
'permlevel': 0, 'permlevel': 0,
'print_hide': 1 'print_hide': 1
@ -1559,6 +1573,20 @@
'print_hide': 1 'print_hide': 1
}, },
# DocField
{
'allow_on_submit': 1,
'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
'description': u'The date on which recurring invoice will be stop',
'doctype': u'DocField',
'fieldname': u'end_date',
'fieldtype': u'Date',
'label': u'End Date',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',

View File

@ -99,10 +99,12 @@ erpnext.AccountsChart = Class.extend({
}, },
onrender: function(treenode) { onrender: function(treenode) {
if (ctype == 'Account') {
var bal = treenode.data && treenode.data.balance.split(' ') || ['','']; var bal = treenode.data && treenode.data.balance.split(' ') || ['',''];
treenode.parent.append('<span class="balance-area"><span style="color: #aaa">'+ bal[0] + '</span> ' treenode.parent.append('<span class="balance-area"><span style="color: #aaa">'+ bal[0] + '</span> '
+ bal[1] + '</span>'); + bal[1] + '</span>');
} }
}
}); });
this.tree.rootnode.$a.click(); this.tree.rootnode.$a.click();
}, },

View File

@ -125,6 +125,7 @@ erpnext.desktop.show_pending_notifications = function() {
add_circle('support', 'open_support_tickets', 'Open Support Tickets'); add_circle('support', 'open_support_tickets', 'Open Support Tickets');
add_circle('todo', 'things_todo', 'Things To Do'); add_circle('todo', 'things_todo', 'Things To Do');
add_circle('calendar', 'todays_events', 'Todays Events'); add_circle('calendar', 'todays_events', 'Todays Events');
add_circle('project', 'open_tasks', 'Open Tasks');
erpnext.update_messages(); erpnext.update_messages();

View File

@ -85,7 +85,7 @@ class DocType:
msgprint("Please create naming series for Attendance.\nGo to Setup--> Numbering Series.") msgprint("Please create naming series for Attendance.\nGo to Setup--> Numbering Series.")
raise Exception raise Exception
else: else:
sr = series[0][0] or '' sr = series[0] or ''
return {'fy':fy,'comp':comp,'sr':sr} return {'fy':fy,'comp':comp,'sr':sr}

View File

@ -59,13 +59,6 @@ class DocType:
def validate(self): def validate(self):
if not self.doc.opening_date:
msgprint("Please enter Opening Date.")
raise Exception
elif getdate(self.doc.opening_date) > getdate(nowdate()):
msgprint("Opening date can not be future date")
raise Exception
if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date): if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date):
msgprint("'Expected Start Date' can not be greater than 'Expected End Date'") msgprint("'Expected Start Date' can not be greater than 'Expected End Date'")
raise Exception raise Exception
@ -74,42 +67,31 @@ class DocType:
msgprint("'Actual Start Date' can not be greater than 'Actual End Date'") msgprint("'Actual Start Date' can not be greater than 'Actual End Date'")
raise Exception raise Exception
if self.doc.opening_date and self.doc.review_date and getdate(self.doc.opening_date) > getdate(self.doc.review_date):
msgprint("Review Date should be greater than or equal to Opening Date ")
raise Exception
if self.doc.closing_date and self.doc.review_date and getdate(self.doc.closing_date) < getdate(self.doc.review_date):
msgprint("Closing Date should be greater than or equal to Review Date ")
raise Exception
# on update # on update
#-------------------------------------------- #--------------------------------------------
def on_update(self): def on_update(self):
if self.doc.status =='Open' and self.doc.allocated_to: if self.doc.status =='Open' and self.doc.allocated_to:
if self.doc.task_email_notify and (self.doc.allocated_to != self.doc.allocated_to_old): if self.doc.task_email_notify:
self.doc.sent_reminder = 0 self.send_notification()
self.doc.allocated_to_old = self.doc.allocated_to
self.sent_notification()
if self.doc.exp_start_date: if self.doc.exp_start_date:
sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name) sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name)
self.add_calendar_event() self.add_calendar_event()
else: else:
msgprint("An Expeted start date has not been set for this task.Please set 'Expected Start date'\ msgprint("Tip: Add an expected start date to create a calendar event.")
to add an event to allocated persons calender.You can save a task without this also.")
def validate_for_pending_review(self): def validate_for_pending_review(self):
if not self.doc.allocated_to: if not self.doc.allocated_to:
msgprint("Please enter allocated_to.") msgprint("Please enter Allocated To.")
raise Exception raise Exception
self.validate_with_timesheet_dates() self.validate_with_timesheet_dates()
#Sent Notification #Sent Notification
def sent_notification(self): def send_notification(self):
i = { i = {
'name' : self.doc.name, 'name' : self.doc.name,
'senders_name': self.doc.allocated_to, 'senders_name': self.doc.senders_name,
'opening_date': self.doc.opening_date, 'opening_date': self.doc.opening_date,
'exp_start_date': self.doc.exp_start_date, 'exp_start_date': self.doc.exp_start_date,
'exp_end_date' : self.doc.exp_end_date, 'exp_end_date' : self.doc.exp_end_date,
@ -119,8 +101,12 @@ class DocType:
'description': self.doc.description 'description': self.doc.description
} }
task_label = '[Task Updated] '
if self.doc.creation==self.doc.modified:
task_label = '[New Task] '
msg2="""<h2>%(name)s</h2> msg2="""<h2>%(name)s</h2>
<p>This is a Notification for the task %(name)s that has been assigned to you <p>This is a Notification for the task %(name)s that has been assigned / updated to you
by %(senders_name)s on %(opening_date)s</p> by %(senders_name)s on %(opening_date)s</p>
<p><b>Subject:</b> %(subject)s </p> <p><b>Subject:</b> %(subject)s </p>
<p><b>Project:</b> %(project)s</p> <p><b>Project:</b> %(project)s</p>
@ -128,11 +114,9 @@ class DocType:
<p><b>Expected Start Date:</b> %(exp_start_date)s</p> <p><b>Expected Start Date:</b> %(exp_start_date)s</p>
<p><b>Expected End Date:</b> %(exp_end_date)s</p> <p><b>Expected End Date:</b> %(exp_end_date)s</p>
<p><b>Details:</b> %(description)s</p> <p><b>Details:</b> %(description)s</p>
<p>You will also recieve another reminder 2 days before the commencement of the task</p>
<p>Good Luck!</p>
<p>(This notification is autogenerated)</p>""" % i <p>(This notification is autogenerated)</p>""" % i
sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\ sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\
subject='A task has been assigned') subject= task_label + self.doc.subject)

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:36:06', 'creation': '2012-04-02 16:02:06',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 14:36:06', 'modified': '2012-06-04 12:33:35',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -26,7 +26,7 @@
'show_in_menu': 0, 'show_in_menu': 0,
'subject': u'%(subject)s', 'subject': u'%(subject)s',
'tag_fields': u'status', 'tag_fields': u'status',
'version': 254 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -62,6 +62,7 @@
'doctype': u'DocPerm', 'doctype': u'DocPerm',
'permlevel': 0, 'permlevel': 0,
'role': u'All', 'role': u'All',
'submit': 0,
'write': 1 'write': 1
}, },
@ -75,6 +76,7 @@
# DocPerm # DocPerm
{ {
'amend': 1,
'cancel': 1, 'cancel': 1,
'create': 1, 'create': 1,
'doctype': u'DocPerm', 'doctype': u'DocPerm',
@ -115,6 +117,79 @@
'reqd': 1 'reqd': 1
}, },
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'allocated_to',
'fieldtype': u'Link',
'label': u'Allocated To',
'oldfieldname': u'allocated_to',
'oldfieldtype': u'Link',
'options': u'Profile',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'task_email_notify',
'fieldtype': u'Check',
'label': u'Send Mail Notification',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'exp_start_date',
'fieldtype': u'Date',
'label': u'Expected Start Date',
'oldfieldname': u'exp_start_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'exp_end_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Expected End Date',
'oldfieldname': u'exp_end_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'project',
'fieldtype': u'Link',
'label': u'Project',
'oldfieldname': u'project',
'oldfieldtype': u'Link',
'options': u'Project',
'permlevel': 0,
'trigger': u'Client'
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -129,46 +204,6 @@
'trigger': u'Client' 'trigger': u'Client'
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'opening_date',
'fieldtype': u'Date',
'label': u'Creation Date',
'oldfieldname': u'opening_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed" || doc.status == "Pending Review"',
'doctype': u'DocField',
'fieldname': u'review_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Review Date',
'oldfieldname': u'review_date',
'oldfieldtype': u'Date',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed"',
'doctype': u'DocField',
'fieldname': u'closing_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Closing Date',
'oldfieldname': u'closing_date',
'oldfieldtype': u'Date',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -186,16 +221,60 @@
# DocField # DocField
{ {
'colour': u'White:FFF',
'doctype': u'DocField', 'doctype': u'DocField',
'fieldname': u'project', 'fieldname': u'allocated_to_name',
'fieldtype': u'Link', 'fieldtype': u'Data',
'label': u'Project', 'hidden': 1,
'oldfieldname': u'project', 'label': u'Allocated To Name',
'oldfieldtype': u'Link', 'oldfieldname': u'allocated_to_name',
'options': u'Project', 'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'description',
'fieldtype': u'Text Editor',
'label': u'Details',
'oldfieldname': u'description',
'oldfieldtype': u'Text Editor',
'permlevel': 0, 'permlevel': 0,
'trigger': u'Client' 'reqd': 0,
'width': u'300px'
},
# DocField
{
'colour': u'White:FFF',
'description': u'If linked to a Customer',
'doctype': u'DocField',
'fieldname': u'customer_details',
'fieldtype': u'Section Break',
'label': u'Customer Details',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'external_or_internal',
'fieldtype': u'Select',
'label': u'External or Internal',
'oldfieldname': u'external_or_internal',
'oldfieldtype': u'Select',
'options': u'External\nInternal',
'permlevel': 0
}, },
# DocField # DocField
@ -223,73 +302,6 @@
'permlevel': 1 'permlevel': 1
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'allocated_to_old',
'fieldtype': u'Link',
'hidden': 1,
'label': u'Allocated To Old',
'no_copy': 1,
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'allocated_to',
'fieldtype': u'Link',
'label': u'Allocated To',
'oldfieldname': u'allocated_to',
'oldfieldtype': u'Link',
'options': u'Profile',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'task_email_notify',
'fieldtype': u'Check',
'label': u'Sent Mail Notification',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'allocated_to_name',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Allocated To Name',
'oldfieldname': u'allocated_to_name',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'sent_reminder',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Sent Reminder',
'no_copy': 1,
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -316,6 +328,14 @@
'reqd': 0 'reqd': 0
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break25',
'fieldtype': u'Column Break',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -338,102 +358,6 @@
'permlevel': 0 'permlevel': 0
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'external_or_internal',
'fieldtype': u'Select',
'label': u'External or Internal',
'oldfieldname': u'external_or_internal',
'oldfieldtype': u'Select',
'options': u'External\nInternal',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amended_from',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Amended From',
'no_copy': 1,
'oldfieldname': u'amended_from',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amendment_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Amendment Date',
'no_copy': 1,
'oldfieldname': u'amendment_date',
'oldfieldtype': u'Date',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'description',
'fieldtype': u'Text Editor',
'label': u'Details',
'oldfieldname': u'description',
'oldfieldtype': u'Text Editor',
'permlevel': 0,
'reqd': 0,
'width': u'300px'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'first_creation_flag',
'fieldtype': u'Int',
'hidden': 1,
'in_filter': 0,
'label': u'First Creation Flag',
'no_copy': 1,
'oldfieldname': u'first_creation_flag',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'second_creation_flag',
'fieldtype': u'Int',
'hidden': 1,
'label': u'Second Creation Flag',
'no_copy': 1,
'oldfieldname': u'second_creation_flag',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -455,32 +379,6 @@
'width': u'50%' 'width': u'50%'
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'exp_start_date',
'fieldtype': u'Date',
'label': u'Expected Start Date',
'oldfieldname': u'exp_start_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'exp_end_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Expected End Date',
'oldfieldname': u'exp_end_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 0,
'search_index': 1
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -557,5 +455,84 @@
'oldfieldname': u'actual_budget', 'oldfieldname': u'actual_budget',
'oldfieldtype': u'Currency', 'oldfieldtype': u'Currency',
'permlevel': 0 'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'more_details',
'fieldtype': u'Section Break',
'label': u'More Details',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'opening_date',
'fieldtype': u'Date',
'label': u'Creation Date',
'oldfieldname': u'opening_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed" || doc.status == "Pending Review"',
'doctype': u'DocField',
'fieldname': u'review_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Review Date',
'oldfieldname': u'review_date',
'oldfieldtype': u'Date',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed"',
'doctype': u'DocField',
'fieldname': u'closing_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Closing Date',
'oldfieldname': u'closing_date',
'oldfieldtype': u'Date',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amended_from',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Amended From',
'no_copy': 1,
'oldfieldname': u'amended_from',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amendment_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Amendment Date',
'no_copy': 1,
'oldfieldname': u'amendment_date',
'oldfieldtype': u'Date',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1
} }
] ]

View File

@ -164,6 +164,13 @@ GanttGrid = function(chart, s_date, e_date) {
this.make(); this.make();
} }
GanttGrid.prototype.make = function() {
this.body = make_table(this.wrapper, 1, 2, '100%', ['30%','70%']);
this.make_grid();
this.make_labels();
this.y_labels = $a($td(this.body, 0, 0), 'div', '', {marginTop:'2px', position:'relative'});
}
GanttGrid.prototype.make_grid = function() { GanttGrid.prototype.make_grid = function() {
// grid ----------- // grid -----------
var ht = this.chart.tasks.length * 40 + 'px'; var ht = this.chart.tasks.length * 40 + 'px';
@ -191,17 +198,12 @@ GanttGrid.prototype.make_labels = function() {
if(d.getDate()==today.getDate() && d.getMonth()==today.getMonth() && d.getYear() == today.getYear()) { if(d.getDate()==today.getDate() && d.getMonth()==today.getMonth() && d.getYear() == today.getYear()) {
$y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'}) $y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'})
} }
var d = date.add_days(this.start_date, 1); var d = date.str_to_obj(date.add_days(this.start_date, 1));
} }
this.start_date = date.str_to_obj(date.user_to_str(this.s_date)); this.start_date = date.str_to_obj(date.user_to_str(this.s_date));
} }
GanttGrid.prototype.make = function() {
this.body = make_table(this.wrapper, 1, 2, '100%', ['30%','70%']);
this.make_grid();
this.make_labels();
this.y_labels = $a($td(this.body, 0, 0), 'div', '', {marginTop:'2px', position:'relative'});
}
GanttGrid.prototype.get_x = function(dt) { GanttGrid.prototype.get_x = function(dt) {
var d = date.str_to_obj(dt); // convert to obj var d = date.str_to_obj(dt); // convert to obj
@ -256,6 +258,7 @@ GanttTask = function(grid, data, idx) {
} }
GanttTask.prototype.make_tooltip = function(d) { GanttTask.prototype.make_tooltip = function(d) {
$(this.body).click(function() {
var t = '<div>'; var t = '<div>';
if(d[0]) t += '<b>Task: </b>' + d[0]; if(d[0]) t += '<b>Task: </b>' + d[0];
if(d[5]) t += '<br><b>Priority: </b>' + d[5]; if(d[5]) t += '<br><b>Priority: </b>' + d[5];
@ -266,23 +269,7 @@ GanttTask.prototype.make_tooltip = function(d) {
if(d[4]) t += '<br><b>To: </b>' + date.str_to_user(d[4]); if(d[4]) t += '<br><b>To: </b>' + date.str_to_user(d[4]);
t += '</div>'; t += '</div>';
$(this.body).qtip({ msgprint(t)
content:t,
position:{
corner:{
tooltip: 'topMiddle', // Use the corner...
target: 'bottomMiddle' // ...and opposite corner
}
},
style:{
border: {
width: 5,
radius: 10
},
padding: 10,
tip: true, // Give it a speech bubble tip with automatic corner detection
name: 'green' // Style it according to the preset 'cream' style
}
}) })
} }

View File

@ -4,12 +4,12 @@
<h1>Projects</h1> <h1>Projects</h1>
<hr> <hr>
<div style="width: 48%; float: left;"> <div style="width: 48%; float: left;">
<h4><a href="#!List/Project">Project</a></h4>
<p class="help">Project master</p>
<br>
<h4><a href="#!List/Task">Task</a></h4> <h4><a href="#!List/Task">Task</a></h4>
<p class="help">Project activity / task</p> <p class="help">Project activity / task</p>
<br> <br>
<h4><a href="#!List/Project">Project</a></h4>
<p class="help">Project master</p>
<br>
<h4><a href="#!List/Timesheet">Timesheet</a></h4> <h4><a href="#!List/Timesheet">Timesheet</a></h4>
<p class="help">Timesheet for tasks</p> <p class="help">Timesheet for tasks</p>
</div> </div>

View File

@ -137,13 +137,6 @@ cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) {
return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50';
} }
cur_frm.cscript.CGHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Customer Group');
}
loadpage('Sales Browser',call_back);
}
// ----- // -----
// lead // lead
@ -196,6 +189,7 @@ cur_frm.cscript.get_common_list_view = function(parent, doc, doctype) {
cur_frm.cscript.render_list(doc, doctype, parent, ListView); cur_frm.cscript.render_list(doc, doctype, parent, ListView);
} }
cur_frm.cscript.make_si_list = function(parent, doc) { cur_frm.cscript.make_si_list = function(parent, doc) {
var ListView = wn.views.ListView.extend({ var ListView = wn.views.ListView.extend({
init: function(doclistview) { init: function(doclistview) {

View File

@ -23,7 +23,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(user =='Guest'){ if(user =='Guest'){
hide_field(['status', 'naming_series', 'order_lost_reason', hide_field(['status', 'naming_series', 'order_lost_reason',
'customer', 'rating', 'fax', 'website', 'territory', 'customer', 'rating', 'fax', 'website', 'territory',
'TerritoryHelp', 'address_line1', 'address_line2', 'city', 'state', 'address_line1', 'address_line2', 'city', 'state',
'country', 'pincode', 'address', 'lead_owner', 'market_segment', 'country', 'pincode', 'address', 'lead_owner', 'market_segment',
'industry', 'campaign_name', 'interested_in', 'company', 'industry', 'campaign_name', 'interested_in', 'company',
'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date', 'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date',
@ -67,15 +67,6 @@ cur_frm.cscript.status = function(doc, cdt, cdn){
cur_frm.cscript.refresh(doc, cdt, cdn); cur_frm.cscript.refresh(doc, cdt, cdn);
} }
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Territory');
}
loadpage('Sales Browser',call_back);
}
//Trigger in Item Table //Trigger in Item Table
//=================================== //===================================
cur_frm.cscript.item_code=function(doc,cdt,cdn){ cur_frm.cscript.item_code=function(doc,cdt,cdn){

View File

@ -286,7 +286,7 @@ class DocType(TransactionBase):
#----------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------
def validate_order_type(self): def validate_order_type(self):
#validate delivery date #validate delivery date
if self.doc.order_type != 'Maintenance' and not self.doc.delivery_date: if self.doc.order_type == 'Sales' and not self.doc.delivery_date:
msgprint("Please enter 'Expected Delivery Date'") msgprint("Please enter 'Expected Delivery Date'")
raise Exception raise Exception

View File

@ -66,16 +66,6 @@ cur_frm.cscript.country = function(doc, dt, dn) {
cur_frm.cscript.get_states(doc, dt, dn); cur_frm.cscript.get_states(doc, dt, dn);
} }
// territory help - cutsomer + sales partner
// -----------------------------------------
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Territory');
}
loadpage('Sales Browser',call_back);
}
// get query select Territory // get query select Territory
// --------------------------- // ---------------------------

View File

@ -26,7 +26,7 @@ cur_frm.cscript.onload = function(){
//get query select item group //get query select item group
cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND (`tabItem Group`.`rgt` > '+doc.rgt+' or `tabItem Group`.`lft` < '+doc.lft+') AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50'; return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50';
} }
cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.refresh = function(doc, cdt, cdn) {

View File

@ -52,7 +52,7 @@ class DocType:
def validate(self): def validate(self):
if self.doc.lft and self.doc.rgt: if self.doc.lft and self.doc.rgt:
res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name)) res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_item_group,self.doc.item_group_name))
if not res: if not res:
msgprint("Please enter proper parent item group.") msgprint("Please enter proper parent item group.")
raise Exception raise Exception

View File

@ -38,19 +38,10 @@ cur_frm.cscript.country = function(doc, cdt, cdn) {
); );
} }
cur_frm.cscript.TreePage = function(nm){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val(nm);
}
loadpage('Sales Browser',call_back);
}
//get query select sales person //get query select sales person
cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND (`tabSales Person`.`rgt` > '+doc.rgt+' or `tabSales Person`.`lft` < '+doc.lft+') AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY `tabSales Person`.`name` ASC LIMIT 50'; return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY `tabSales Person`.`name` ASC LIMIT 50';
} }
//get query select Territory //get query select Territory

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:36:23', 'creation': '2012-04-13 11:56:32',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 18:49:47', 'modified': '2012-05-31 11:28:32',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -25,7 +25,7 @@
'section_style': u'Simple', 'section_style': u'Simple',
'server_code_error': u' ', 'server_code_error': u' ',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 132 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -55,6 +55,46 @@
'name': u'Sales Person' 'name': u'Sales Person'
}, },
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'write': 0
},
# DocPerm # DocPerm
{ {
'cancel': 1, 'cancel': 1,
@ -75,46 +115,6 @@
'write': 0 'write': 0
}, },
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'write': 0
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -316,7 +316,7 @@
'fieldtype': u'HTML', 'fieldtype': u'HTML',
'label': u'Territory Help', 'label': u'Territory Help',
'oldfieldtype': u'HTML', 'oldfieldtype': u'HTML',
'options': u'<a href="javascript:cur_frm.cscript.TreePage(\'Territory\');">To manage Territory, click here</a>', 'options': u'<a href="#!Sales Browser/Territory">To manage Territories, click here</a>',
'permlevel': 0 'permlevel': 0
}, },

View File

@ -31,7 +31,7 @@ cur_frm.cscript.onload = function(){
//get query select territory //get query select territory
cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND (`tabTerritory`.`rgt` > '+doc.rgt+' or `tabTerritory`.`lft` < '+doc.lft+') AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
} }
@ -39,13 +39,3 @@ cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50'
} }
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Territory');
}
loadpage('Sales Browser',call_back);
}

View File

@ -61,7 +61,7 @@ class DocType:
def validate(self): def validate(self):
if self.doc.lft and self.doc.rgt: if self.doc.lft and self.doc.rgt:
res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_territory,self.doc.territory_name)) res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_territory,self.doc.territory_name))
if not res: if not res:
msgprint("Please enter proper parent territory.") msgprint("Please enter proper parent territory.")
raise Exception raise Exception

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:36:25', 'creation': '2012-04-13 11:56:32',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 18:50:08', 'modified': '2012-05-31 11:39:33',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -27,7 +27,7 @@
'section_style': u'Simple', 'section_style': u'Simple',
'server_code_error': u' ', 'server_code_error': u' ',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 87 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -57,6 +57,56 @@
'name': u'Territory' 'name': u'Territory'
}, },
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Master Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'write': 0
},
# DocPerm # DocPerm
{ {
'cancel': 1, 'cancel': 1,
@ -67,56 +117,6 @@
'write': 1 'write': 1
}, },
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Master Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'write': 0
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -176,7 +176,7 @@
'fieldtype': u'HTML', 'fieldtype': u'HTML',
'label': u'TerritoryHelp', 'label': u'TerritoryHelp',
'oldfieldtype': u'HTML', 'oldfieldtype': u'HTML',
'options': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>', 'options': u'<a href="#!Sales Browser/Territory">To manage Territories, click here</a>',
'permlevel': 0 'permlevel': 0
}, },

View File

@ -135,6 +135,7 @@ erpnext.update_messages = function(reset) {
show_in_circle('open_support_tickets', r.message.open_support_tickets); show_in_circle('open_support_tickets', r.message.open_support_tickets);
show_in_circle('things_todo', r.message.things_todo); show_in_circle('things_todo', r.message.things_todo);
show_in_circle('todays_events', r.message.todays_events); show_in_circle('todays_events', r.message.todays_events);
show_in_circle('open_tasks', r.message.open_tasks);
} else { } else {
clearInterval(wn.updates.id); clearInterval(wn.updates.id);

View File

@ -20,6 +20,15 @@ def get_open_support_tickets():
WHERE status = 'Open'""") WHERE status = 'Open'""")
return open_support_tickets and cint(open_support_tickets[0][0]) or 0 return open_support_tickets and cint(open_support_tickets[0][0]) or 0
def get_open_tasks():
"""
Returns a count of open tasks
"""
from webnotes.utils import cint
return webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabTask`
WHERE status = 'Open'""")[0][0]
def get_things_todo(): def get_things_todo():
""" """
Returns a count of incomplete todos Returns a count of incomplete todos
@ -51,4 +60,5 @@ def get_global_status_messages(arg=None):
'open_support_tickets': get_open_support_tickets(), 'open_support_tickets': get_open_support_tickets(),
'things_todo': get_things_todo(), 'things_todo': get_things_todo(),
'todays_events': get_todays_events(), 'todays_events': get_todays_events(),
'open_tasks': get_open_tasks()
} }

View File

@ -80,15 +80,6 @@ cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "No" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50' return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "No" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50'
} }
cur_frm.cscript.IGHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Item Group');
}
loadpage('Sales Browser',call_back);
}
// for description from attachment // for description from attachment
// takes the first attachment and creates // takes the first attachment and creates
// a table with both image and attachment in HTML // a table with both image and attachment in HTML

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-04-02 16:02:29', 'creation': '2012-04-30 18:33:53',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-04-30 14:08:08', 'modified': '2012-05-31 11:18:10',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -216,7 +216,7 @@
'fieldtype': u'HTML', 'fieldtype': u'HTML',
'label': u'IGHelp', 'label': u'IGHelp',
'oldfieldtype': u'HTML', 'oldfieldtype': u'HTML',
'options': u'<a href="javascript:cur_frm.cscript.IGHelp();">To manage Item Group, click here</a>', 'options': u'<a href="#!Sales Browser/Item Group">To manage Item Groups, click here</a>',
'permlevel': 0 'permlevel': 0
}, },

View File

@ -59,3 +59,12 @@ cur_frm.cscript.supplier = function(doc,dt,dn) {
if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1); if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
if(doc.supplier) unhide_field(['supplier_name','address_display']); if(doc.supplier) unhide_field(['supplier_name','address_display']);
} }
//item code
//----------
cur_frm.fields_dict['item_code'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabItem`.`name`,`tabItem`.`description` FROM `tabItem` \
WHERE `tabItem`.`docstatus`!= 2 AND ifnull(`tabItem`.`has_serial_no`, "No") = "Yes" \
AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") \
AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` ASC LIMIT 50';
}

View File

@ -37,7 +37,8 @@ var cfn_set_fields = function(doc, cdt, cdn) {
else hide_field(['production_order', 'process']); else hide_field(['production_order', 'process']);
doc.from_warehouse = ''; doc.from_warehouse = '';
doc.to_warehosue = ''; doc.to_warehouse = '';
refresh_field(['from_warehosue', 'to_warehouse']);
if (doc.process == 'Backflush' || doc.purpose == 'Other'){ if (doc.process == 'Backflush' || doc.purpose == 'Other'){
unhide_field('fg_completed_qty'); unhide_field('fg_completed_qty');
} }

View File

@ -114,7 +114,7 @@ class DocType(TransactionBase):
""" Add calendar event for Maintenece Schedule in calendar of Allocated person""" """ Add calendar event for Maintenece Schedule in calendar of Allocated person"""
event = Document('Event') event = Document('Event')
event.owner = incharge_email event.owner = incharge_email
event.description = "Item Code:%s and Reference:%s" %(item_code,self.doc.name) event.description = "Reference:%s, Item Code:%s and Customer: %s" %(self.doc.name, item_code, self.doc.customer)
event.event_date = scheduled_date event.event_date = scheduled_date
event.event_hour = '10:00' event.event_hour = '10:00'
event.event_type = 'Private' event.event_type = 'Private'

View File

@ -473,9 +473,8 @@ var doc_link=DocLink;function roundNumber(num,dec){var result=Math.round(num*Mat
function same_day(d1,d2){if(d1.getFullYear()==d2.getFullYear()&&d1.getMonth()==d2.getMonth()&&d1.getDate()==d2.getDate())return true;else return false;} function same_day(d1,d2){if(d1.getFullYear()==d2.getFullYear()&&d1.getMonth()==d2.getMonth()&&d1.getDate()==d2.getDate())return true;else return false;}
var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31} var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i} var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i}
wn.datetime={str_to_obj:function(d){if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];} wn.datetime={str_to_obj:function(d){if(typeof d=="object")return d;if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];}
if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){if(typeof d1=='string')d1=dateutil.str_to_obj(d1);if(typeof d2=='string')d2=dateutil.str_to_obj(d2);return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){dt=dateutil.str_to_obj(d) if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){if(typeof d=='string')return d;return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){if(typeof d1=='string')d1=dateutil.str_to_obj(d1);if(typeof d2=='string')d2=dateutil.str_to_obj(d2);return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){var dt=dateutil.str_to_obj(d);var new_dt=new Date(dt.getTime()+(days*24*60*60*1000));return dateutil.obj_to_str(new_dt);},add_months:function(d,months){dt=dateutil.str_to_obj(d)
dt.setTime(dt.getTime()+(days*24*60*60*1000));return dateutil.obj_to_str(dt);},add_months:function(d,months){dt=dateutil.str_to_obj(d)
new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate()) new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate())
if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))} if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))}
return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0)) return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0))
@ -582,7 +581,7 @@ wn.urllib={get_arg:function(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]
return"";else return"";else
return decodeURIComponent(results[1]);},get_dict:function(){var d={} return decodeURIComponent(results[1]);},get_dict:function(){var d={}
var t=window.location.href.split('?')[1];if(!t)return d;if(t.indexOf('#')!=-1)t=t.split('#')[0];if(!t)return d;t=t.split('&');for(var i=0;i<t.length;i++){var a=t[i].split('=');d[decodeURIComponent(a[0])]=decodeURIComponent(a[1]);} var t=window.location.href.split('?')[1];if(!t)return d;if(t.indexOf('#')!=-1)t=t.split('#')[0];if(!t)return d;t=t.split('&');for(var i=0;i<t.length;i++){var a=t[i].split('=');d[decodeURIComponent(a[0])]=decodeURIComponent(a[1]);}
return d;},get_base_url:function(){var url=window.location.href.split('#')[0].split('?')[0].split('index.cgi')[0];if(url.substr(url.length-1,1)=='/')url=url.substr(0,url.length-1) return d;},get_base_url:function(){var url=window.location.href.split('#')[0].split('?')[0].split('app.html')[0];if(url.substr(url.length-1,1)=='/')url=url.substr(0,url.length-1)
return url},get_file_url:function(file_id){return repl('files/%(fn)s',{fn:file_id})}} return url},get_file_url:function(file_id){return repl('files/%(fn)s',{fn:file_id})}}
get_url_arg=wn.urllib.get_arg;get_url_dict=wn.urllib.get_dict; get_url_arg=wn.urllib.get_arg;get_url_dict=wn.urllib.get_dict;
/* /*
@ -2270,7 +2269,7 @@ $('body').append('<a class="erpnext-logo" title="Powered by ERPNext" \
href="http://erpnext.com" target="_blank"></a>')} href="http://erpnext.com" target="_blank"></a>')}
erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;} erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;}
if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}} if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);}else{clearInterval(wn.updates.id);}} show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);}else{clearInterval(wn.updates.id);}}
wn.call({method:'startup.startup.get_global_status_messages',callback:set_messages});}else{erpnext.toolbar.set_new_comments(0);$('#unread_messages').toggle(false);}} wn.call({method:'startup.startup.get_global_status_messages',callback:set_messages});}else{erpnext.toolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);} erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
wn.updates.id=setInterval(erpnext.update_messages,60000);} wn.updates.id=setInterval(erpnext.update_messages,60000);}

View File

@ -360,9 +360,8 @@ var doc_link=DocLink;function roundNumber(num,dec){var result=Math.round(num*Mat
function same_day(d1,d2){if(d1.getFullYear()==d2.getFullYear()&&d1.getMonth()==d2.getMonth()&&d1.getDate()==d2.getDate())return true;else return false;} function same_day(d1,d2){if(d1.getFullYear()==d2.getFullYear()&&d1.getMonth()==d2.getMonth()&&d1.getDate()==d2.getDate())return true;else return false;}
var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31} var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i} var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i}
wn.datetime={str_to_obj:function(d){if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];} wn.datetime={str_to_obj:function(d){if(typeof d=="object")return d;if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];}
if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){if(typeof d1=='string')d1=dateutil.str_to_obj(d1);if(typeof d2=='string')d2=dateutil.str_to_obj(d2);return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){dt=dateutil.str_to_obj(d) if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){if(typeof d=='string')return d;return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){if(typeof d1=='string')d1=dateutil.str_to_obj(d1);if(typeof d2=='string')d2=dateutil.str_to_obj(d2);return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){var dt=dateutil.str_to_obj(d);var new_dt=new Date(dt.getTime()+(days*24*60*60*1000));return dateutil.obj_to_str(new_dt);},add_months:function(d,months){dt=dateutil.str_to_obj(d)
dt.setTime(dt.getTime()+(days*24*60*60*1000));return dateutil.obj_to_str(dt);},add_months:function(d,months){dt=dateutil.str_to_obj(d)
new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate()) new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate())
if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))} if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))}
return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0)) return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0))
@ -469,7 +468,7 @@ wn.urllib={get_arg:function(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]
return"";else return"";else
return decodeURIComponent(results[1]);},get_dict:function(){var d={} return decodeURIComponent(results[1]);},get_dict:function(){var d={}
var t=window.location.href.split('?')[1];if(!t)return d;if(t.indexOf('#')!=-1)t=t.split('#')[0];if(!t)return d;t=t.split('&');for(var i=0;i<t.length;i++){var a=t[i].split('=');d[decodeURIComponent(a[0])]=decodeURIComponent(a[1]);} var t=window.location.href.split('?')[1];if(!t)return d;if(t.indexOf('#')!=-1)t=t.split('#')[0];if(!t)return d;t=t.split('&');for(var i=0;i<t.length;i++){var a=t[i].split('=');d[decodeURIComponent(a[0])]=decodeURIComponent(a[1]);}
return d;},get_base_url:function(){var url=window.location.href.split('#')[0].split('?')[0].split('index.cgi')[0];if(url.substr(url.length-1,1)=='/')url=url.substr(0,url.length-1) return d;},get_base_url:function(){var url=window.location.href.split('#')[0].split('?')[0].split('app.html')[0];if(url.substr(url.length-1,1)=='/')url=url.substr(0,url.length-1)
return url},get_file_url:function(file_id){return repl('files/%(fn)s',{fn:file_id})}} return url},get_file_url:function(file_id){return repl('files/%(fn)s',{fn:file_id})}}
get_url_arg=wn.urllib.get_arg;get_url_dict=wn.urllib.get_dict; get_url_arg=wn.urllib.get_arg;get_url_dict=wn.urllib.get_dict;
/* /*
@ -724,7 +723,7 @@ $('body').append('<a class="erpnext-logo" title="Powered by ERPNext" \
href="http://erpnext.com" target="_blank"></a>')} href="http://erpnext.com" target="_blank"></a>')}
erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;} erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;}
if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}} if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);}else{clearInterval(wn.updates.id);}} show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);}else{clearInterval(wn.updates.id);}}
wn.call({method:'startup.startup.get_global_status_messages',callback:set_messages});}else{erpnext.toolbar.set_new_comments(0);$('#unread_messages').toggle(false);}} wn.call({method:'startup.startup.get_global_status_messages',callback:set_messages});}else{erpnext.toolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);} erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
wn.updates.id=setInterval(erpnext.update_messages,60000);} wn.updates.id=setInterval(erpnext.update_messages,60000);}