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

Conflicts:
	erpnext/accounts/doctype/sales_invoice/sales_invoice.py
	erpnext/patches/patch_list.py
	public/js/report-legacy.js
This commit is contained in:
Rushabh Mehta 2012-07-26 15:46:13 +02:00
commit 0fa628bf86
13 changed files with 114 additions and 22 deletions

View File

@ -555,6 +555,9 @@ def notify_errors(inv, owner):
def assign_task_to_owner(inv, msg, users):
for d in users:
if d.lower() == 'administrator':
d = webnotes.conn.sql("select ifnull(email_id, '') \
from `tabProfile` where name = 'Administrator'")[0][0]
from webnotes.widgets.form import assign_to
args = {
'assign_to' : d,

View File

@ -499,12 +499,9 @@ cur_frm.cscript.view_ledger_entry = function(){
}
// Default values for recurring invoices
cur_frm.cscript.convert_into_recurring_invoice = function(doc) {
if (doc.convert_into_recurring_invoice) {
doc.repeat_on_day_of_month = doc.posting_date.split('-')[2];
doc.notification_email_address = [doc.owner, doc.contact_email].join(', ');
refresh_field(['repeat_on_day_of_month', 'notification_email_address']);
}
cur_frm.cscript.convert_into_recurring_invoice = function(doc, dt, dn) {
if (doc.convert_into_recurring_invoice)
get_server_fields('set_default_recurring_values','','',doc, dt, dn, 0);
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
@ -514,3 +511,17 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
}
cur_frm.cscript.notify(doc, args);
}
cur_frm.cscript.invoice_period_from_date = function(doc, dt, dn) {
if(doc.invoice_period_from_date) {
var recurring_type_map = { 'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12 };
var months = $(recurring_type_map).attr(doc.recurring_type);
if(months) {
var to_date = wn.datetime.add_months(doc.invoice_period_from_date,
months);
doc.invoice_period_to_date = wn.datetime.add_days(to_date, -1);
refresh_field('invoice_period_to_date');
}
}
}

View File

@ -636,10 +636,82 @@ class DocType(TransactionBase):
sales_com_obj.update_prevdoc_detail(0,self)
self.make_gl_entries(is_cancel=1)
# Get Warehouse
def get_warehouse(self):
w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
w = w and w[0][0] or ''
if not w:
ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
if not ps:
msgprint("To make POS entry, please create POS Setting from Setup --> Accounts --> POS Setting and refresh the system.")
raise Exception
elif not ps[0][1]:
msgprint("Please enter warehouse in POS Setting")
else:
w = ps[0][1]
return w
# on update
def on_update(self):
# Set default warehouse from pos setting
#----------------------------------------
if cint(self.doc.is_pos) == 1:
self.set_actual_qty()
w = self.get_warehouse()
if w:
for d in getlist(self.doclist, 'entries'):
if not d.warehouse:
d.warehouse = cstr(w)
if flt(self.doc.paid_amount) == 0:
if self.doc.cash_bank_account:
webnotes.conn.set(self.doc, 'paid_amount',
(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
else:
# show message that the amount is not paid
webnotes.conn.set(self.doc,'paid_amount',0)
webnotes.msgprint("Note: Payment Entry not created since 'Cash/Bank Account' was not specified.")
else:
webnotes.conn.set(self.doc,'paid_amount',0)
webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount))
#-------------------------------------------------------------------------------------
def set_default_recurring_values(self):
from webnotes.utils import cstr
owner_email = self.doc.owner
if owner_email.lower() == 'administrator':
owner_email = cstr(webnotes.conn.get_value("Profile", "Administrator", "email"))
ret = {
'repeat_on_day_of_month' : getdate(self.doc.posting_date).day,
'notification_email_address' : ', '.join([owner_email, cstr(self.doc.contact_email)]),
}
return ret
def validate_notification_email_id(self):
if self.doc.notification_email_address:
from webnotes.utils import validate_email_add
for add in self.doc.notification_email_address.replace('\n', '').replace(' ', '').split(","):
if add and not validate_email_add(add):
msgprint("%s is not a valid email address" % add, raise_exception=1)
else:
msgprint("Notification Email Addresses not specified for recurring invoice",
raise_exception=1)
def on_update_after_submit(self):
self.convert_into_recurring()
def convert_into_recurring(self):
if self.doc.convert_into_recurring_invoice:
self.validate_notification_email_id()
if not self.doc.recurring_type:
msgprint("Please select recurring type", raise_exception=1)
elif not self.doc.invoice_period_from_date or not self.doc.invoice_period_to_date:
@ -673,6 +745,3 @@ class DocType(TransactionBase):
webnotes.conn.set(self.doc, 'next_date', next_date)
def on_update_after_submit(self):
self.convert_into_recurring()

View File

@ -5,7 +5,7 @@
{
'creation': '2012-04-03 12:49:53',
'docstatus': 0,
'modified': '2012-04-03 12:49:53',
'modified': '2012-07-23 11:49:53',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -14,7 +14,6 @@
{
'columns': u'Account\x01ID',
'criteria_name': u'Trial Balance',
'description': u'Trial Balance',
'dis_filters': u'transaction_date',
'doc_type': u'Account',
'doctype': 'Search Criteria',

View File

@ -0,0 +1,4 @@
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('accounts', 'search_criteria', 'trial_balance')

View File

@ -516,4 +516,9 @@ patch_list = [
'patch_file': 'unicode_conf',
'description': "appends from __future__ import unicode_literals to py files if necessary"
},
]
{
'patch_module': 'patches.july_2012',
'patch_file': 'sync_trial_balance',
'description': "sync trial balance"
},
]

View File

@ -69,7 +69,7 @@ class DocType:
def validate(self):
import string
if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
msgprint("Please Enter Quotation Lost Reason")
msgprint("Please Enter Lost Reason under More Info section")
raise Exception
if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':

View File

@ -34,7 +34,7 @@ erpnext.toolbar.setup = function() {
<ul class="dropdown-menu" id="toolbar-help">\
</ul></li>')
$('#toolbar-help').append('<li><a href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">\
$('#toolbar-help').append('<li><a href="https://erpnext.com/manual" target="_blank">\
Documentation</a></li>')
$('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">\

View File

@ -227,5 +227,7 @@ class DocType:
def on_cancel(self):
msgprint("Cancellation of stock reconciliation is temporarily suspended. The feature will come back within 2-3 days.")
raise Exception
self.get_reconciliation_data(submit = 0)
self.do_stock_reco(is_submit = -1)

View File

@ -34,9 +34,8 @@
{% endif %}
{% include 'html/comment.html' %}
<button class="btn add-comment">Add Comment</button>
</div>
<button class="btn add-comment">Add Comment</button>
</div>
<div class="layout-side-section">

View File

@ -353,7 +353,7 @@ return[me.fieldselect.$select.find('option:selected').attr('table'),me.field.df.
this.add_field_option(this.filter_fields[i])}else{this.build_options();}},build_options:function(){var me=this;me.table_fields=[];var std_filters=[{fieldname:'name',fieldtype:'Data',label:'ID',parent:me.doctype},{fieldname:'modified',fieldtype:'Date',label:'Last Modified',parent:me.doctype},{fieldname:'owner',fieldtype:'Data',label:'Created By',parent:me.doctype},{fieldname:'creation',fieldtype:'Date',label:'Created On',parent:me.doctype},{fieldname:'_user_tags',fieldtype:'Data',label:'Tags',parent:me.doctype},{fieldname:'docstatus',fieldtype:'Int',label:'Doc Status',parent:me.doctype},];var doctype_obj=locals['DocType'][me.doctype];if(doctype_obj&&cint(doctype_obj.istable)){std_filters=std_filters.concat([{fieldname:'parent',fieldtype:'Data',label:'Parent',parent:me.doctype}]);}
if(this.with_blank){this.$select.append($('<option>',{value:''}).text(''));}
$.each(std_filters.concat(wn.meta.docfield_list[me.doctype]),function(i,df){me.add_field_option(df);});$.each(me.table_fields,function(i,table_df){if(table_df.options){$.each(wn.meta.docfield_list[table_df.options],function(i,df){me.add_field_option(df);});}});},add_field_option:function(df){var me=this;if(me.doctype&&df.parent==me.doctype){var label=df.label;var table=me.doctype;if(df.fieldtype=='Table')me.table_fields.push(df);}else{var label=df.label+' ('+df.parent+')';var table=df.parent;}
if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!me.fields_by_name[df.fieldname]){this.$select.append($('<option>',{value:df.fieldname,table:table}).text(label));me.fields_by_name[df.fieldname]=df;}}})
if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!(me.fields_by_name[df.fieldname]&&me.fields_by_name[df.fieldname]['parent']==df.parent)){this.$select.append($('<option>',{value:df.fieldname,table:table}).text(label));me.fields_by_name[df.fieldname]=df;}}})
/*
* lib/js/wn/views/container.js
*/
@ -2296,7 +2296,7 @@ wn.provide('erpnext.toolbar');erpnext.toolbar.setup=function(){erpnext.toolbar.a
onclick="return false;">Help<b class="caret"></b></a>\
<ul class="dropdown-menu" id="toolbar-help">\
</ul></li>')
$('#toolbar-help').append('<li><a href="http://erpnext.blogspot.com/2011/03/erpnext-help.html" target="_blank">\
$('#toolbar-help').append('<li><a href="https://erpnext.com/manual" target="_blank">\
Documentation</a></li>')
$('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">\
Forum</a></li>')

View File

@ -240,7 +240,7 @@ return[me.fieldselect.$select.find('option:selected').attr('table'),me.field.df.
this.add_field_option(this.filter_fields[i])}else{this.build_options();}},build_options:function(){var me=this;me.table_fields=[];var std_filters=[{fieldname:'name',fieldtype:'Data',label:'ID',parent:me.doctype},{fieldname:'modified',fieldtype:'Date',label:'Last Modified',parent:me.doctype},{fieldname:'owner',fieldtype:'Data',label:'Created By',parent:me.doctype},{fieldname:'creation',fieldtype:'Date',label:'Created On',parent:me.doctype},{fieldname:'_user_tags',fieldtype:'Data',label:'Tags',parent:me.doctype},{fieldname:'docstatus',fieldtype:'Int',label:'Doc Status',parent:me.doctype},];var doctype_obj=locals['DocType'][me.doctype];if(doctype_obj&&cint(doctype_obj.istable)){std_filters=std_filters.concat([{fieldname:'parent',fieldtype:'Data',label:'Parent',parent:me.doctype}]);}
if(this.with_blank){this.$select.append($('<option>',{value:''}).text(''));}
$.each(std_filters.concat(wn.meta.docfield_list[me.doctype]),function(i,df){me.add_field_option(df);});$.each(me.table_fields,function(i,table_df){if(table_df.options){$.each(wn.meta.docfield_list[table_df.options],function(i,df){me.add_field_option(df);});}});},add_field_option:function(df){var me=this;if(me.doctype&&df.parent==me.doctype){var label=df.label;var table=me.doctype;if(df.fieldtype=='Table')me.table_fields.push(df);}else{var label=df.label+' ('+df.parent+')';var table=df.parent;}
if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!me.fields_by_name[df.fieldname]){this.$select.append($('<option>',{value:df.fieldname,table:table}).text(label));me.fields_by_name[df.fieldname]=df;}}})
if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!(me.fields_by_name[df.fieldname]&&me.fields_by_name[df.fieldname]['parent']==df.parent)){this.$select.append($('<option>',{value:df.fieldname,table:table}).text(label));me.fields_by_name[df.fieldname]=df;}}})
/*
* lib/js/wn/views/container.js
*/

View File

@ -28,7 +28,7 @@ _r.ReportBuilder.prototype.run=function(){this.dt.run();}
_r.ReportBuilder.prototype.clear_criteria=function(){this.column_picker.clear();this.column_picker.set_defaults();for(var i=0;i<this.filter_fields.length;i++){this.filter_fields[i].df.filter_hide=0;this.filter_fields[i].df.ignore=0;if(this.filter_fields[i].is_custom){this.filter_fields[i].df.filter_hide=1;this.filter_fields[i].df.ignore=1;}
this.filter_fields[i].set_input(null);}
this.set_sort_options();this.set_main_title('Report: '+get_doctype_label(this.doctype));this.current_loaded=null;this.customized_filters=null;this.sc=null;this.has_index=1;this.has_headings=1;for(var i in this.fn_list)this[this.fn_list[i]]=null;}
_r.ReportBuilder.prototype.set_main_title=function(t,t1){var title=t+(t1?t1:'');_r.rb_con.appframe.$titlebar.find('.report-title').html(title);set_title(title);}
_r.ReportBuilder.prototype.set_main_title=function(title){_r.rb_con.appframe.$titlebar.find('.report-title').html(title);set_title(title);}
_r.ReportBuilder.prototype.select_column=function(dt,label,value){if(value==null)value=1;this.column_picker.set(dt,label,value);}
_r.ReportBuilder.prototype.set_filter=function(dt,label,value){if(this.filter_fields_dict[dt+'\1'+label])
this.filter_fields_dict[dt+'\1'+label].set_input(value);}
@ -44,7 +44,7 @@ var acl=[];var new_sl=[];for(var i=0;i<acl.length;i++){var tmp=acl[i].split(' AS
this.set_sort_options(new_sl);if(sc&&sc.sort_by){this.dt.sort_sel.value=sc.sort_by;}
if(sc&&sc.sort_order){sc.sort_order=='ASC'?this.dt.set_asc():this.dt.set_desc();}
if(sc&&sc.page_len){this.dt.page_len_sel.inp.value=sc.page_len;}
this.current_loaded=criteria_name;this.set_main_title(criteria_name,sc.description);}
this.current_loaded=criteria_name;this.set_main_title(criteria_name);}
_r.ReportBuilder.prototype.setup_filters_and_cols=function(){function can_dt_be_submitted(dt){return locals.DocType[dt]&&locals.DocType[dt].is_submittable||0;}
var me=this;var dt=me.parent_dt?me.parent_dt:me.doctype;var fl=[{'fieldtype':'Data','label':'ID','fieldname':'name','in_filter':1,'parent':dt},{'fieldtype':'Data','label':'Owner','fieldname':'owner','in_filter':1,'parent':dt},{'fieldtype':'Date','label':'Created on','fieldname':'creation','in_filter':0,'parent':dt},{'fieldtype':'Date','label':'Last modified on','fieldname':'modified','in_filter':0,'parent':dt},];if(can_dt_be_submitted(dt)){fl[fl.length]={'fieldtype':'Check','label':'Saved','fieldname':'docstatus','search_index':1,'in_filter':1,'def_filter':1,'parent':dt};fl[fl.length]={'fieldtype':'Check','label':'Submitted','fieldname':'docstatus','search_index':1,'in_filter':1,'def_filter':1,'parent':dt};fl[fl.length]={'fieldtype':'Check','label':'Cancelled','fieldname':'docstatus','search_index':1,'in_filter':1,'parent':dt};}
me.make_datatable();me.orig_sort_list=[];if(me.parent_dt){me.setup_dt_filters_and_cols(fl,me.parent_dt);var fl=[];}