fixed conflict
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index e31076e..c3c43e0 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -312,18 +312,14 @@
supplier = ''
if d.purchase_order and not d.purchase_order in self.po_list:
supplier = sql("select supplier from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0]
- doctype = 'purchase order'
- doctype_no = cstr(d.purchase_order)
if supplier and not cstr(self.doc.supplier) == cstr(supplier):
- msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,doctype,doctype_no))
+ msgprint("Supplier name %s do not match with supplier name of purhase order: %s." %(self.doc.supplier,cstr(d.purchase_order)))
raise Exception , " Validation Error "
if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
supplier = sql("select supplier from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt)[0][0]
- doctype = 'purchase receipt'
- doctype_no = cstr(d.purchase_receipt)
if supplier and not cstr(self.doc.supplier) == cstr(supplier):
- msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,doctype,doctype_no))
+ msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,cstr(d.purchase_receipt)))
raise Exception , " Validation Error "
# Validate values with reference document
@@ -337,7 +333,7 @@
def validate_po_pr(self, d):
# check po / pr for qty and rates and currency and conversion rate
- # always import_rate must be equal to import_rate of purchase order
+ # currency, import_rate must be equal to currency, import_rate of purchase order
if d.purchase_order and not d.purchase_order in self.po_list:
# currency
currency = cstr(sql("select currency from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0])
@@ -346,7 +342,7 @@
raise Exception
# import_rate
rate = flt(sql('select import_rate from `tabPurchase Order Item` where item_code=%s and parent=%s and name = %s', (d.item_code, d.purchase_order, d.po_detail))[0][0])
- if abs(rate - flt(d.import_rate)) > 1:
+ if abs(rate - flt(d.import_rate)) > 1 and cint(get_defaults('maintain_same_rate')):
msgprint("Import Rate for %s in the Purchase Order is %s. Rate must be same as Purchase Order Rate" % (d.item_code,rate))
raise Exception
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.css b/erpnext/accounts/page/accounts_browser/accounts_browser.css
index bbbbb6b..718da36 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.css
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.css
@@ -18,3 +18,12 @@
font-weight: bold;
text-decoration: underline;
}
+
+span.balance-area {
+ float: right;
+ height: 13px;
+}
+
+span.balance-bold {
+ font-weight: bold;
+}
\ No newline at end of file
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 580fd33..667a37e 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -23,7 +23,7 @@
pscript['onload_Accounts Browser'] = function(wrapper){
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
wrapper.appframe.add_button('New Company', function() { newdoc('Company'); }, 'icon-plus');
- wrapper.appframe.add_button('Refresh', function() {
+ wrapper.appframe.add_button('Refresh', function() {
wrapper.$company_select.change();
}, 'icon-refresh');
@@ -79,7 +79,7 @@
this.tree = new wn.ui.Tree({
parent: $(wrapper).find('.tree-area'),
label: company,
- args: {ctype: ctype},
+ args: {ctype: ctype, comp: company},
method: 'accounts.page.accounts_browser.accounts_browser.get_children',
click: function(link) {
if(me.cur_toolbar)
@@ -92,17 +92,25 @@
me.cur_toolbar = link.toolbar;
$(me.cur_toolbar).toggle(true);
}
+
+ // bold
+ $('.balance-bold').removeClass('balance-bold'); // deselect
+ $(link).parent().find('.balance-area:first').addClass('balance-bold'); // select
+ },
+ onrender: function(treenode) {
+ var bal = treenode.data && treenode.data.balance.split(' ') || ['',''];
+ treenode.parent.append('<span class="balance-area"><span style="color: #aaa">'+ bal[0] + '</span> '
+ + bal[1] + '</span>');
}
});
- this.tree.rootnode.$a.click();
+ this.tree.rootnode.$a.click();
},
make_link_toolbar: function(link) {
var data = $(link).data('node-data');
if(!data) return;
link.toolbar = $('<span class="tree-node-toolbar"></span>').insertAfter(link);
-
// edit
$('<a href="#!Form/'+encodeURIComponent(this.ctype)+'/'
+encodeURIComponent(data.value)+'">Edit</a>').appendTo(link.toolbar);
@@ -235,386 +243,4 @@
});
d.show();
}
-});
-
-/*
-pscript.make_chart = function(b, wrapper) {
- pscript.ctype = b;
- $(wrapper).find('.tree-area').empty()
- $(wrapper).find('.layout-sidesection').empty()
-
- //================== table body======================================
- var ac_main_grid = make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px", padding:"4px",tableLayout: "fixed", borderCollapse: "collapse"});
- $y($td(ac_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px"});
- pscript.account_tree = $a($td(ac_main_grid,0,0),'div', '',{minHeight:'400px'});
- $y($td(ac_main_grid,0,1),{border: "1px solid #DDD"});
- pscript.la = $a($td(ac_main_grid,0,1),'div');
- pscript.acc_period_bal = $a($td(ac_main_grid,0,1),'div');
-
- //=====================footer area ==================================
- if (pscript.ctype == 'Account') {
- var footer = $a($i('ab_body'),'div','',{backgroundColor: "#FFD", padding: "8px", color: "#444", fontSize: "12px", marginTop: "14px"});
-
- var help1 = $a(footer,'span');
- help1.innerHTML = "<strong>Note:</strong> To create accounts for Customers and Suppliers, please create <a href='#!List/Customer'>Customer</a> and <a href='#!List/Supplier'>Supplier</a>"
- + " Masters. This will ensure that the accounts are linked to your Selling and Buying Processes. The Account Heads for Customer and Supplier will automatically be created."
- }
-
- // header and toolbar
- // ------------------
- wrapper.appframe.$titlebar.find('.appframe-title').html('Chart of '+pscript.ctype+'s');
-
- // select company
- // --------------
- var tab = make_table(select_area, 1, 2, null, [], {verticalAlign:'middle', padding: '2px'});
- $td(tab,0,0).innerHTML = 'Select Company'.bold();
- var sel = $a($td(tab,0,1),'select','',{width:'160px'});
-
- // set tree
- var set_tree = function() {
- if(pscript.ac_tree) {
- pscript.ac_tree.body.innerHTML = '';
- }
- pscript.make_ac_tree();
- var cn = sel_val(sel);
- var n = pscript.ac_tree.addNode(null, cn, null,pscript.ac_tree.std_onclick, pscript.ac_tree.std_onexp);
- n.rec = {};
- n.rec.name = 'Root Node';
- n.rec.account_name = cn;
- n.rec.cost_center_name = cn;
- pscript.set_ac_head('',n.rec);
- $ds(pscript.ac_head_area);
- }
-
- // select company
- add_sel_options(sel, ['Loading...']);
- var callback = function(r,rt) {
- empty_select(sel);
- add_sel_options(sel,r.message.cl,sys_defaults.company);
- set_tree();
- sel.onchange = function() { set_tree(); }
- }
- $c_obj('GL Control', 'get_companies', '', callback);
-
- pscript.ab_company_sel = sel;
-
- pscript.make_ac_head();
- pscript.make_group_area();
- pscript.make_ledger_area();
- pscript.make_new_acc_dialog();
- pscript.make_new_cost_center_dialog();
-
-}
-
-pscript.make_ac_tree = function() {
- //var type= sel_val($i('ctype'))
- var type= pscript.ctype;
- var tree = new Tree(pscript.account_tree, '90%');
- pscript.ac_tree = tree;
-
- // on click
- tree.std_onclick = function(node) {
-
-
- pscript.cur_node = node;
-
- // show ledger
- pscript.set_ac_head(node.parent_account, node.rec,type);
- }
-
- // on expand
- tree.std_onexp = function(node) {
- if(node.expanded_once)return;
- $ds(node.loading_div);
- //set_ac_head
- var callback = function(r,rt) {
-
- $dh(node.loading_div);
- var n = tree.allnodes[r.message.parent_acc_name];
-
- var cl = r.message.cl;
-
- if(type=='Account'){
- for(var i=0;i<cl.length;i++) {
- var imgsrc=null;
- var has_children = true;
- if(cl[i].group_or_ledger=='Ledger') {
- var imgsrc = 'images/lib/icons/page.png';
- has_children = false;
- }
- var t = tree.addNode(n, cl[i].account_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
- t.rec = cl[i];
- t.parent_account = r.message.parent;
- }
- }
- else{
- for (var i=0;i<cl.length;i++){
- var imgsrc=null;
- var has_children = true;
- if(cl[i].group_or_ledger=='Ledger') {
- var imgsrc = 'images/lib/icons/page.png';
- has_children = false;
- }
- var t = tree.addNode(n, cl[i].cost_center_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null);
- t.rec = cl[i];
- t.parent_account = r.message.parent;
- }
- }
- }
-
- if (type=='Account'){
- var arg = [node.rec.name, node.rec.account_name, sel_val(pscript.ab_company_sel), pscript.ctype];
- } else{
- var arg = [node.rec.name, node.rec.cost_center_name,sel_val(pscript.ab_company_sel), pscript.ctype];
- }
-
- $c_obj('GL Control','get_cl',arg.join(','),callback);
- }
-}
-
-pscript.make_ac_head = function() {
- var div = $a(pscript.la,'div','ac_head');
- div.main_head = $a(div,'h3','',{padding:'4px', margin:'0px',backgroundColor:'#EEEEEE',borderBottom:'1px solid #AAAAAA'});
-
- div.sub_head1 = $a(div,'div');
- div.sub_head2 = $a(div,'div');
-
- div.balance_area = $a(div,'div');
- $a(div.balance_area,'span','sectionHeading').innerHTML = "Balance:";
- div.balance = $a(div.balance_area,'span','ac_balance');
-
- div.sub_head = $btn(div,'Edit',function() { loaddoc(this.dt, this.dn); });
- pscript.ac_head_area = div;
-}
-
-// Group / Ledger Area - set properties in the right column
-//---------------------------------------------------------
-
-pscript.set_ac_head = function(parent_account, r,type) {
- var d = pscript.ac_head_area;
- d.main_head.innerHTML = r.account_name;
- $ds(d.sub_head);
- $ds(d.balance_area);
-
- var callback = function(r,rt) {
- dcc = r.message;
- }
- $c_obj('GL Control', 'get_company_currency', pscript.ab_company_sel.value, callback);
-
- if(r.name!='Root Node') {
- // Account group/ledger area
- if(type=='Account'){
- d.sub_head.dt = 'Account'; d.sub_head.dn = r.name
-
- d.sub_head1.innerHTML = r.debit_or_credit + ' - ' + r.group_or_ledger;
- d.sub_head2.innerHTML = 'Group: ' + parent_account;
- if(r.group_or_ledger=='Ledger') {
- $ds(pscript.ledger_area);
- $ds(pscript.gl_rep);
- $dh(pscript.cc_rep);
- $dh(pscript.group_area);
- } else {
- $dh(pscript.ledger_area);
- $ds(pscript.group_area);
- $ds(pscript.acc_add_btn);
- $dh(pscript.cc_add_btn);
- }
-
- var callback = function(r,rt) {
- dcc = r.message;
- }
- $c_obj('GL Control', 'get_company_currency', pscript.ab_company_sel.value, callback);
-
- d.balance.innerHTML = (dcc)+ ' ' + (r.balance ? fmt_money(r.balance) :'0.00');
- }
- //cost center group/ledger area
- else{
- $dh(d.balance_area);
- d.main_head.innerHTML = r.cost_center_name;
- d.sub_head.dt = 'Cost Center'; d.sub_head.dn = r.name
-
- d.sub_head1.innerHTML = '' ;
- d.sub_head2.innerHTML = 'Group: ' + parent_account;
- if(r.group_or_ledger=='Ledger') {
- $ds(pscript.ledger_area);
- $dh(pscript.gl_rep);
- $ds(pscript.cc_rep);
- $dh(pscript.group_area);
- } else {
- $dh(pscript.ledger_area);
- $ds(pscript.group_area);
- $ds(pscript.cc_add_btn);
- $dh(pscript.acc_add_btn);
- }
-
- d.balance.innerHTML ='';
- }
- } else {
- $dh(d.sub_head);
- $dh(pscript.ledger_area);
- $dh(pscript.group_area);
- $dh(d.balance_area);
- d.sub_head1.innerHTML = '';
- d.sub_head2.innerHTML = 'Explore tree on your left to see details';
- }
-
- pscript.acc_period_bal.innerHTML = '';
-}
-
-// Group Area
-// ----------
-
-pscript.make_group_area = function(type) {
- pscript.group_area = $a(pscript.la,'div','ac_ledger');
-
- // refresh
- ref_btn = $a(pscript.group_area, 'div', '', {fontSize: '14px',marginBottom: '8px', marginTop: '24px', fontWeight: 'bold'});
- ref_btn.innerHTML = '<img src="images/lib/icons/page_refresh.gif" style="margin-right: 8px"><span class="link_type">Refresh Tree</span>';
- ref_btn.onclick= function() {
- pscript.cur_node.clear_child_nodes();
- pscript.cur_node.expand();
- }
- pscript.group_area.ref_btn = ref_btn;
-
- // button for acc adding
- pscript.acc_add_btn = $btn(pscript.group_area, '+ Add a child Account', function(){ pscript.new_acc_dialog.show(); });
-
- // button for cost center adding
- pscript.cc_add_btn = $btn(pscript.group_area, '+ Add a child Cost Center', null);
-
- //showing new cost center dialog
- pscript.cc_add_btn.onclick = function(){
-
- // check for cost center name & group or ledger
- pscript.cc_dialog.widgets['Create'].onclick = function() {
- if(!pscript.cc_dialog.widgets['New Cost Center Name'].value) {
- msgprint('Please enter New Cost Center Name'); return;
- }
- if(!sel_val(pscript.cc_dialog.widgets['Group or Ledger'])) {
- msgprint('Please specify cost center is group or ledger'); return;
- }
- //args making
- args = {
- 'cost_center_name' : pscript.cc_dialog.widgets['New Cost Center Name'].value,
- 'parent_cost_center' : pscript.cur_node.rec.name,
- 'group_or_ledger' : sel_val(pscript.cc_dialog.widgets['Group or Ledger']),
- 'company_name' : sel_val(pscript.ab_company_sel),
- 'company_abbr': '',
- 'old_parent':''
- }
-
- //create cost center -- server to gl control
- $c_obj('GL Control', 'add_cc', docstring(args), function(r,rt) {
- pscript.cc_dialog.widgets['New Cost Center Name'].value='';
- pscript.cc_dialog.hide();
- pscript.group_area.ref_btn.onclick();
- });
- }
-
- pscript.new_cost_center_dialog.show();
- }
-
-
-
-
-}
-
-// Ledger Area
-// ----------
-
-pscript.make_ledger_area = function() {
- pscript.ledger_area = $a(pscript.la,'div','ac_ledger');
-
- //General ledger report link
- pscript.gl_rep = $a(pscript.ledger_area, 'div','', {fontSize: '14px',marginBottom: '8px', fontWeight: 'bold'});
- pscript.gl_rep.innerHTML = '<img src="images/lib/icons/report.png" style="margin-right: 8px"><span class="link_type">Open Ledger</span>';
- pscript.gl_rep.onclick = function(){ pscript.make_report('gl'); }
-
-}
-
-pscript.make_report = function(flag){
- if(flag=='gl'){
- var callback = function(report){
- report.set_filter('GL Entry', 'Account',pscript.cur_node.rec.name)
- report.dt.run();
- }
- loadreport('GL Entry','General Ledger',callback);
- }
-}
-
-// New Account
-pscript.make_new_acc_dialog = function() {
- var d = new Dialog(300,400,'Create A New Account');
- d.make_body([
- ['HTML','Heading'],
- ['Data','New Account Name'],
- ['Select','Group or Ledger','Specify whether the new account is a Ledger or Group'],
- ['Select','Account Type','[Optional] Specify the type of this account'],
- ['Data','Tax Rate','Specify the default tax rate'],
- ['Select','Master Type','Specify the master type of this account'],
- ['Button','Create']
- ]);
-
- add_sel_options(d.widgets['Group or Ledger'], ['Group', 'Ledger'],'Group');
- add_sel_options(d.widgets['Account Type'], ['', 'Fixed Asset Account','Bank or Cash','Expense Account','Tax','Income Account','Chargeable'], '');
- add_sel_options(d.widgets['Master Type'], ['NA', 'Supplier','Customer','Employee'],'NA');
-
- // hide / show account type
- d.widgets['Group or Ledger'].onchange = function() {
- if(sel_val(this)=='Ledger')$ds(d.rows['Account Type']);
- else $dh(d.rows['Account Type']);
- }
-
- // hide / show tax rate
- d.widgets['Account Type'].onchange = function() {
- if(sel_val(this)=='Tax' || sel_val(this)=='Chargeable')$ds(d.rows['Tax Rate']);
- else $dh(d.rows['Tax Rate']);
- }
-
- d.onshow = function() {
- $dh(this.rows['Account Type']);
- $dh(this.rows['Tax Rate']);
- this.widgets['Group or Ledger'].selectedIndex = 0;
- this.widgets['Account Type'].selectedIndex = 0;
- this.widgets['Master Type'].selectedIndex = 0;
- d.widgets['New Account Name'].value = '';
- d.widgets['Tax Rate'].value = '';
- }
-
- d.widgets['Create'].onclick = function() {
- if(!d.widgets['New Account Name'].value) {
- msgprint('Please enter New Account Name'); return;
- }
- if(!sel_val(d.widgets['Master Type'])) {
- msgprint('Please enter master type of this new account'); return;
- }
- args = {
- 'account_name' : d.widgets['New Account Name'].value,
- 'parent_account' : pscript.cur_node.rec.name,
- 'group_or_ledger' : sel_val(d.widgets['Group or Ledger']),
- 'company' : sel_val(pscript.ab_company_sel),
- 'account_type' : sel_val(d.widgets['Account Type']),
- 'tax_rate' : d.widgets['Tax Rate'].value,
- 'master_type': sel_val(d.widgets['Master Type'])
- }
- $c_obj('GL Control', 'add_ac', docstring(args), function(r,rt) { d.hide(); pscript.group_area.ref_btn.onclick(); });
- }
- pscript.new_acc_dialog = d;
-
-}
-
-// New Cost Center
-pscript.make_new_cost_center_dialog = function(){
- pscript.cc_dialog = new Dialog(300,400,'Create A New Cost Center');
- pscript.cc_dialog.make_body([
- ['HTML','Heading'],
- ['Data','New Cost Center Name'],
- ['Select','Group or Ledger','Specify whether the new cost center is a Ledger or Group'],
- ['Button','Create']
- ]);
-
- add_sel_options(pscript.cc_dialog.widgets['Group or Ledger'], ['Group','Ledger'], 'Group');
-
- pscript.new_cost_center_dialog = pscript.cc_dialog;
-}
-*/
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.py b/erpnext/accounts/page/accounts_browser/accounts_browser.py
index ee4ec55..18c7c76 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.py
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.py
@@ -1,4 +1,5 @@
import webnotes
+from webnotes.utils import get_defaults, cstr
@webnotes.whitelist()
def get_companies():
@@ -7,25 +8,41 @@
@webnotes.whitelist()
def get_children():
args = webnotes.form_dict
- ctype = args['ctype']
- company_field = ctype=='Account' and 'company' or 'company_name'
+ ctype, company = args['ctype'], args['comp']
+ company_field = ctype=='Account' and 'company' or 'company_name'
+
# root
- if args['parent'] in get_companies():
- return webnotes.conn.sql("""select
+ if args['parent'] == company:
+ acc = webnotes.conn.sql(""" select
name as value, if(group_or_ledger='Group', 1, 0) as expandable
from `tab%s`
where ifnull(parent_%s,'') = ''
- and %s = %s
- and docstatus<2
+ and %s = %s and docstatus<2
order by name""" % (ctype, ctype.lower().replace(' ','_'), company_field, '%s'),
args['parent'], as_dict=1)
+ else:
+ # other
+ acc = webnotes.conn.sql("""select
+ name as value, if(group_or_ledger='Group', 1, 0) as expandable
+ from `tab%s`
+ where ifnull(parent_%s,'') = %s
+ and docstatus<2
+ order by name""" % (ctype, ctype.lower().replace(' ','_'), '%s'),
+ args['parent'], as_dict=1)
+
+ if ctype == 'Account':
+ currency = webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", company)[0][0]
+ for each in acc:
+ bal = webnotes.conn.sql("select balance from `tabAccount Balance` \
+ where account = %s and period = %s", (each.get('value'), get_defaults('fiscal_year')))[0][0]
+ each['balance'] = currency + ' ' + cstr(bal)
+
+ return acc
- # other
- return webnotes.conn.sql("""select
- name as value, if(group_or_ledger='Group', 1, 0) as expandable
- from `tab%s`
- where ifnull(parent_%s,'') = %s
- and docstatus<2
- order by name""" % (ctype, ctype.lower().replace(' ','_'), '%s'),
- args['parent'], as_dict=1)
\ No newline at end of file
+
+@webnotes.whitelist()
+def get_account_balance():
+ args = webnotes.form_dict
+ acc = args['acc']
+ return 'Rs. 100'
\ No newline at end of file
diff --git a/erpnext/patches/may_2012/same_purchase_rate_patch.py b/erpnext/patches/may_2012/same_purchase_rate_patch.py
new file mode 100644
index 0000000..6cca178
--- /dev/null
+++ b/erpnext/patches/may_2012/same_purchase_rate_patch.py
@@ -0,0 +1,8 @@
+def execute():
+ import webnotes
+ from webnotes.model.code import get_obj
+ gd = get_obj('Global Defaults')
+ gd.doc.maintain_same_rate = 1
+ gd.doc.save()
+ gd.on_update()
+
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index 4ae8feb..34e384c 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -382,5 +382,10 @@
'patch_file': 'clear_session_cache',
'description': 'clears session cache as shifting to json format'
},
-
-]
+ {
+ 'patch_module': 'patches.may_2012',
+ 'patch_file': 'same_purchase_rate_patch',
+ 'description': 'Main same rate throughout pur cycle: in global defaults, by default set true'
+ },
+
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py
index e2d9b3a..579f1a8 100644
--- a/erpnext/selling/doctype/sms_center/sms_center.py
+++ b/erpnext/selling/doctype/sms_center/sms_center.py
@@ -47,7 +47,6 @@
if self.doc.send_to == 'All Sales Partner Contact':
where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_aprtner = '%s'" % self.doc.sales_partner or " and ifnull(is_sales_partner, 0) = 1"
if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']:
- msgprint("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
rec = sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
elif self.doc.send_to == 'All Lead (Open)':
rec = sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'")
diff --git a/erpnext/selling/page/selling_home/selling_home.html b/erpnext/selling/page/selling_home/selling_home.html
index 2b3414e..05f9858 100644
--- a/erpnext/selling/page/selling_home/selling_home.html
+++ b/erpnext/selling/page/selling_home/selling_home.html
@@ -78,6 +78,11 @@
title = "Sales campaigns"
href="#!List/Campaign">Campaign</a>
</div>
+ <div class="section-item">
+ <a class="section-link"
+ title = "Send mass SMS to your conatacts, leads and employees"
+ href="#!Form/SMS Center/SMS Center">SMS Center</a>
+ </div>
</div>
</div>
<div class="section">
@@ -93,7 +98,7 @@
title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc"
href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a>
</div>
- <!--><div class="section-item">
+ <!--<div class="section-item">
<a class="section-link"
title = "sales trends"
href="#!Sales Dashboard">Sales Dashboard</a>
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index 0427640..9d30885 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -35,7 +35,8 @@
'date_format': 'date_format',
'currency_format':'default_currency_format',
'account_url':'account_url',
- 'allow_negative_stock' : 'allow_negative_stock'
+ 'allow_negative_stock' : 'allow_negative_stock',
+ 'maintain_same_rate' : 'maintain_same_rate'
}
class DocType:
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.txt b/erpnext/setup/doctype/global_defaults/global_defaults.txt
index 5355c10..d1175b7 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.txt
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-18 17:00:50',
+ 'creation': '2012-04-20 14:02:53',
'docstatus': 0,
- 'modified': '2012-04-19 17:24:45',
+ 'modified': '2012-05-22 14:11:21',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -224,8 +224,8 @@
'fieldtype': u'Select',
'label': u'Default Valuation Method',
'options': u'FIFO\nMoving Average'
- },
-
+ },
+
# DocField
{
'colour': u'White:FFF',
@@ -511,6 +511,14 @@
# DocField
{
'doctype': u'DocField',
+ 'fieldname': u'maintain_same_rate',
+ 'fieldtype': u'Check',
+ 'label': u'Maintain same rate throughout purchase cycle'
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
'fieldname': u'hr',
'fieldtype': u'Section Break',
'label': u'HR',
@@ -543,4 +551,4 @@
'fieldtype': u'Data',
'label': u'SMS Sender Name'
}
-]
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py
index a2946f5..f4a72fd 100644
--- a/erpnext/utilities/doctype/address/address.py
+++ b/erpnext/utilities/doctype/address/address.py
@@ -35,20 +35,18 @@
elif self.doc.sales_partner:
self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
- # filter out bad characters in name
- #self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
-#----------------------
-# Call to Validate
-#----------------------
def validate(self):
+ self.validate_for_whom()
self.validate_primary_address()
self.validate_shipping_address()
-#----------------------
-# Validate that there can only be one primary address for particular customer, supplier
-#----------------------
+ def validate_for_whom(self):
+ if not (self.doc.customer or self.doc.supplier or self.doc.sales_partner):
+ msgprint("Please enter value in atleast one of customer, supplier and sales partner field", raise_exception=1)
+
def validate_primary_address(self):
+ """Validate that there can only be one primary address for particular customer, supplier"""
sql = webnotes.conn.sql
if self.doc.is_primary_address == 1:
if self.doc.customer:
@@ -69,10 +67,8 @@
self.doc.is_primary_address = 1
-#----------------------
-# Validate that there can only be one shipping address for particular customer, supplier
-#----------------------
def validate_shipping_address(self):
+ """Validate that there can only be one shipping address for particular customer, supplier"""
sql = webnotes.conn.sql
if self.doc.is_shipping_address == 1:
if self.doc.customer:
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py
index f19ccf1..42a38fd 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.py
+++ b/erpnext/utilities/doctype/sms_control/sms_control.py
@@ -69,14 +69,6 @@
return validated_receiver_list
- # Connect Gateway
- # =========================================================
- def connect_gateway(self):
- "login to gateway"
- from webnotes.utils.webservice import FrameworkServer
- fw = FrameworkServer('www.erpnext.com', '/', '__system@webnotestech.com', 'password', https=1)
- return fw
-
def get_sender_name(self):
"returns name as SMS sender"
sender_name = webnotes.conn.get_value('Global Defaults', None, 'sms_sender_name') or 'ERPNXT'
@@ -117,8 +109,7 @@
if get_value('SMS Settings', None, 'sms_gateway_url'):
ret = self.send_via_personalized_gateway(arg)
msgprint(ret)
- else:
- ret = self.send_via_erpnext_gateway(arg)
+
# Send sms via personalized gateway
# ==========================================================
@@ -135,30 +126,6 @@
return resp
- # Send sms via ERPNext gateway
- # ==========================================================
- def send_via_erpnext_gateway(self, arg):
- fw = self.connect_gateway()
- ret = fw.run_method(method = 'erpnext_utils.sms_control.send_sms', args = arg)
-
- if ret.get('exc'):
- msgprint(ret['exc'])
- raise Exception
- elif ret['message']:
- sms_sent = cint(ret['message']['sms_sent'])
- sms_bal = cint(ret['message']['sms_balance'])
- self.create_sms_log(arg, ret['message']['sms_sent'])
-
- if not sms_sent:
- if sms_bal < len(arg['receiver_list']):
- msgprint("You do not have enough SMS balance. Current SMS Balance: " + cstr(sms_bal) + "\nYou can send mail to sales@erpnext.com to buy additional sms packages")
- raise Exception
- else:
- msgprint("Message sent failed. May be numbers are invalid or some other issues.")
- else:
- msgprint(cstr(sms_sent) + " message sucessfully sent!\nCurrent SMS Balance: " + cstr(cint(ret['message']['sms_balance']) - cint(ret['message']['sms_sent'])))
-
-
# Send Request
# =========================================================
def send_request(self, gateway_url, args):
@@ -182,8 +149,6 @@
api_url += '?'
return server, api_url
-
-
# Create SMS Log
# =========================================================
@@ -195,20 +160,4 @@
sl.message = arg['message']
sl.no_of_requested_sms = len(arg['receiver_list'])
sl.no_of_sent_sms = sent_sms
- sl.save(new=1)
-
- # Get SMS Balance
- # =========================================================
- def get_sms_balance(self):
- arg = { 'account_name' : webnotes.conn.get_value('Control Panel',None,'account_id') }
- if get_value('SMS Settings', None, 'sms_gateway_url'):
- ret = {}
- else:
- fw = self.connect_gateway()
- ret = fw.run_method(mothod = 'erpnext_utils.sms_control.get_sms_balance', args = arg)
-
- if ret.get('exc'):
- msgprint(ret['exc'])
- raise Exception
- else:
- msgprint("Current SMS Balance: " + cstr(ret['message']) + "\nYou can send mail to sales@erpnext.com to buy sms packages")
+ sl.save(new=1)
\ No newline at end of file