Merge branch 'latest' of github.com:webnotes/erpnext into latest
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
index aa12ab8..386f462 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
@@ -38,7 +38,7 @@
'load_default_accounts','',
function(r,rt) {
refresh_field('entries');
- cur_frm.cscript.customer(doc,dt,dn);
+ cur_frm.cscript.customer(doc,dt,dn,onload=true);
}
);
}
@@ -137,18 +137,21 @@
//Customer
-cur_frm.cscript.customer = function(doc,dt,dn) {
+cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
get_server_fields('get_debit_to','','',doc, dt, dn, 0);
cur_frm.refresh();
}
+ var args = onload ? 'onload':''
+ if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback);
- if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
+
+
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
diff --git a/erpnext/buying/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt b/erpnext/buying/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
index fe49f49..fa9ab06 100644
--- a/erpnext/buying/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
+++ b/erpnext/buying/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
@@ -5,130 +5,138 @@
{
'creation': '2010-08-08 17:09:34',
'docstatus': 0,
- 'modified': '2011-09-15 15:04:42',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
+ 'modified': '2012-02-14 15:21:20',
+ 'modified_by': u'Administrator',
+ 'owner': u'Administrator'
},
# These values are common for all Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
+ 'doctype': u'Table Mapper Detail',
'name': '__common__',
- 'parent': 'Indent-Purchase Order',
- 'parentfield': 'table_mapper_details',
- 'parenttype': 'DocType Mapper'
+ 'parent': u'Indent-Purchase Order',
+ 'parentfield': u'table_mapper_details',
+ 'parenttype': u'DocType Mapper'
},
# These values are common for all Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'map': u'Yes',
'name': '__common__',
- 'parent': 'Indent-Purchase Order',
- 'parentfield': 'field_mapper_details',
- 'parenttype': 'DocType Mapper'
+ 'parent': u'Indent-Purchase Order',
+ 'parentfield': u'field_mapper_details',
+ 'parenttype': u'DocType Mapper'
},
# These values are common for all DocType Mapper
{
- 'doctype': 'DocType Mapper',
- 'from_doctype': 'Indent',
- 'module': 'Buying',
+ 'doctype': u'DocType Mapper',
+ 'from_doctype': u'Indent',
+ 'module': u'Buying',
'name': '__common__',
'ref_doc_submitted': 1,
- 'to_doctype': 'Purchase Order'
+ 'to_doctype': u'Purchase Order'
},
# DocType Mapper, Indent-Purchase Order
{
- 'doctype': 'DocType Mapper',
- 'name': 'Indent-Purchase Order'
+ 'doctype': u'DocType Mapper',
+ 'name': u'Indent-Purchase Order'
},
# Field Mapper Detail
{
- 'checking_operator': '=',
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'company',
+ 'checking_operator': u'=',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'company',
'match_id': 0,
- 'to_field': 'company'
+ 'to_field': u'company'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'parenttype',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'parenttype',
'match_id': 1,
- 'to_field': 'prevdoc_doctype'
+ 'to_field': u'prevdoc_doctype'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'parent',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'parent',
'match_id': 1,
- 'to_field': 'prevdoc_docname'
+ 'to_field': u'prevdoc_docname'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'name',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'name',
'match_id': 1,
- 'to_field': 'prevdoc_detail_docname'
+ 'to_field': u'prevdoc_detail_docname'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'uom',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'uom',
'match_id': 1,
- 'to_field': 'stock_uom'
+ 'to_field': u'stock_uom'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'eval:flt(1)',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'eval:flt(1)',
'match_id': 1,
- 'to_field': 'conversion_factor'
+ 'to_field': u'conversion_factor'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'eval:flt(obj.qty) - flt(obj.ordered_qty)',
'match_id': 1,
- 'to_field': 'stock_qty'
+ 'to_field': u'stock_qty'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'eval:flt(obj.qty) - flt(obj.ordered_qty)',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'eval:flt(obj.qty) - flt(obj.ordered_qty)',
'match_id': 1,
- 'to_field': 'qty'
+ 'to_field': u'qty'
+ },
+
+ # Field Mapper Detail
+ {
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'schedule_date',
+ 'match_id': 1,
+ 'to_field': u'schedule_date'
},
# Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
- 'from_table': 'Indent',
+ 'doctype': u'Table Mapper Detail',
+ 'from_table': u'Indent',
'match_id': 0,
- 'reference_key': 'prevdoc_docname',
- 'to_table': 'Purchase Order',
- 'validation_logic': 'docstatus = 1'
+ 'reference_key': u'prevdoc_docname',
+ 'to_table': u'Purchase Order',
+ 'validation_logic': u'docstatus = 1'
},
# Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
- 'from_field': 'indent_details',
- 'from_table': 'Indent Detail',
+ 'doctype': u'Table Mapper Detail',
+ 'from_field': u'indent_details',
+ 'from_table': u'Indent Detail',
'match_id': 1,
- 'reference_doctype_key': 'prevdoc_doctype',
- 'to_field': 'po_details',
- 'to_table': 'PO Detail',
- 'validation_logic': 'qty > ifnull(ordered_qty,0) and docstatus =1'
+ 'reference_doctype_key': u'prevdoc_doctype',
+ 'to_field': u'po_details',
+ 'to_table': u'PO Detail',
+ 'validation_logic': u'qty > ifnull(ordered_qty,0) and docstatus =1'
}
]
\ No newline at end of file
diff --git a/erpnext/patches/jan_mar_2012/subcon_default_val.py b/erpnext/patches/jan_mar_2012/subcon_default_val.py
new file mode 100644
index 0000000..c0bee4c
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/subcon_default_val.py
@@ -0,0 +1,7 @@
+def execute():
+ import webnotes
+ webnotes.conn.sql("""
+ update `tabDocField` set `default` = 'No'
+ where parent in ('Purchase Order', 'Purchase Receipt')
+ and fieldname = 'is_subcontracted'
+ """)
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index cbe10c7..9430038 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -74,5 +74,10 @@
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'account_type_patch',
'description': 'mentioed account type for some tax accounts'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'subcon_default_val',
+ 'description': 'Default value of is_subcontracted in PO, PR is No'
}
]
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 8b81c39..878cf1a 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -11,6 +11,9 @@
try:
import server_tools.gateway_utils
server_tools.gateway_utils.check_login(login_manager.user)
+
+ login_as(login_manager)
+
except ImportError:
pass
@@ -69,3 +72,27 @@
ret = webnotes.conn.sql("""select name, content from `tabLetter Head`
where ifnull(disabled,0)=0""")
return dict(ret)
+
+
+def login_as(login_manager):
+ """
+ Login as functionality -- allows signin from signin.erpnext.com
+ """
+ # login as user
+ user = webnotes.form.getvalue('login_as')
+ if user:
+ if isinstance(webnotes.session, dict):
+ webnotes.session['user'] = user
+ else:
+ webnotes.session = {'user': user}
+
+ login_manager.user = user
+
+ if hasattr(webnotes.defs, 'validate_ip'):
+ msg = getattr(webnotes.defs, 'validate_ip')()
+ if msg: webnotes.msgprint(msg, raise_exception=1)
+
+ # alisaing here... so check if the user is disabled
+ if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]:
+ # throw execption
+ webnotes.msgprint("Authentication Failed", raise_exception=1)
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index b6329c5..d9f4795 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -61,12 +61,13 @@
//customer
-cur_frm.cscript.customer = function(doc,dt,dn) {
+cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh();
}
- if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', '', callback);
+ var args = onload ? 'onload':''
+ if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
}
@@ -112,7 +113,7 @@
cur_frm.cscript.pull_item_details_onload = function(doc,dt,dn){
var callback = function(r,rt){
refresh_field('delivery_note_details');
- cur_frm.cscript.customer(doc,dt,dn);
+ cur_frm.cscript.customer(doc,dt,dn,onload=true);
}
$c_obj(make_doclist(dt,dn),'set_item_details','',callback);
}
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 7979036..7cb7479 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -19,7 +19,8 @@
self.doc.contact_mobile = contact_mobile or ''
self.get_customer_details(self.doc.customer)
- self.get_sales_person(self.doc.customer)
+ if args != 'onload':
+ self.get_sales_person(self.doc.customer)
# Get Customer Default Shipping Address - first load
# -----------------------
@@ -34,8 +35,8 @@
self.doc.contact_mobile = contact_mobile or ''
self.get_customer_details(self.doc.customer)
- if self.doc.doctype != 'Quotation':
- self.get_sales_person(self.doc.customer)
+ if self.doc.doctype != 'Quotation' and args != 'onload':
+ self.get_sales_person(self.doc.customer)
# Get Customer Address
# -----------------------