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

This commit is contained in:
Rushabh Mehta 2012-02-13 13:41:51 +01:00
commit bfc03cf8bd
9 changed files with 93 additions and 91 deletions

View File

@ -23,9 +23,6 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
hide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
//for previously created sales invoice, set required field related to pos
if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn);
@ -33,21 +30,22 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = null;
if(doc.customer && doc.__islocal) {
// called from mapper, update the account names for items and customer
$c_obj(make_doclist(doc.doctype,doc.name),
'load_default_accounts','',
function(r,rt) {
refresh_field('entries');
cur_frm.cscript.customer(doc,dt,dn);
}
);
}
if(!doc.customer && doc.__islocal) {
// new -- load default taxes
cur_frm.cscript.load_taxes(doc, cdt, cdn);
callback = function(doc, dt, dn) {
$c_obj(make_doclist(doc.doctype,doc.name),
'load_default_accounts','',
function(r,rt) {
refresh_field('entries');
cur_frm.cscript.customer(doc,dt,dn);
}
);
}
}
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
}

View File

@ -41,6 +41,9 @@ def delete_user(args):
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
from server_tools.gateway_utils import remove_user_gateway
remove_user_gateway(args['user'])
webnotes.login_manager.logout(user=args['user'])
@webnotes.whitelist()
def add_user(args):

View File

@ -32,15 +32,11 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
}
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// load default charges
if(doc.__islocal && !getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length)
cur_frm.cscript.load_taxes(doc, cdt, cdn);
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
}
// hide - unhide fields based on lead or customer..

View File

@ -6,18 +6,23 @@
// cur_frm.cscript.sales_team_fname - Sales Team fieldname
// ============== Load Default Taxes ===================
cur_frm.cscript.load_taxes = function(doc, cdt, cdn) {
cur_frm.cscript.load_taxes = function(doc, cdt, cdn, callback) {
// run if this is not executed from dt_map...
if(doc.customer) return;
doc = locals[doc.doctype][doc.name];
if(doc.customer || getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) {
if(callback) callback(doc, cdt, cdn);
return;
}
$c_obj([doc],'load_default_taxes','',function(r,rt){
refresh_field('other_charges');
refresh_field('other_charges');
if(callback) callback(doc, cdt, cdn);
});
}
// Gets called after existing item details are update to fill in
// remaining default values
cur_frm.cscript.load_defaults = function(doc, dt, dn) {
cur_frm.cscript.load_defaults = function(doc, dt, dn, callback) {
if(!cur_frm.doc.__islocal) { return; }
doc = locals[doc.doctype][doc.name];
@ -31,11 +36,13 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn) {
LocalDB.set_default_values(children[i]);
}
refresh_field(cur_frm.cscript.fname);
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
}
// Update existing item details
cur_frm.cscript.update_item_details = function(doc, dt, dn) {
cur_frm.cscript.update_item_details = function(doc, dt, dn, callback) {
doc = locals[doc.doctype][doc.name];
if(!cur_frm.doc.__islocal) return;
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
if(children) {
@ -44,7 +51,7 @@ cur_frm.cscript.update_item_details = function(doc, dt, dn) {
if(!r.exc) {
refresh_field(cur_frm.cscript.fname);
doc = locals[doc.doctype][doc.name];
cur_frm.cscript.load_defaults(doc, dt, dn);
cur_frm.cscript.load_defaults(doc, dt, dn, callback);
}
});
}

View File

@ -23,15 +23,12 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
}
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
}
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
if(doc.__islocal) {
if(doc.quotation) cur_frm.cscript['Pull Quotation Details'](doc,cdt,cdn);
} else {
cur_frm.cscript.load_taxes(doc, cdt, cdn);
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
}
}

View File

@ -3,34 +3,34 @@
# These values are common in all dictionaries
{
'creation': '2012-01-23 18:28:40',
'creation': '2012-02-13 11:28:45',
'docstatus': 0,
'modified': '2012-01-23 18:28:40',
'modified_by': 'Administrator',
'owner': 'Administrator'
'modified': '2012-02-13 11:28:45',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Search Criteria
{
'add_col': "`tabAddress`.address_line1 AS 'Address Line 1'\n`tabAddress`.address_line2 AS 'Address Line 2'\n`tabAddress`.city AS 'City'\n`tabAddress`.state AS 'State'\n`tabAddress`.pincode AS 'Pincode'\n`tabAddress`.country AS 'Country'\n`tabContact`.first_name AS 'Contact First Name'\n`tabContact`.last_name AS 'Contact Last Name'\n`tabContact`.phone AS 'Contact Phone'\n`tabContact`.mobile_no AS 'Contact Mobile'\n`tabContact`.email_id AS 'Contact Email'",
'add_cond': '`tabAddress`.customer=`tabCustomer`.name\nifnull(`tabAddress`.is_primary_address, 0)=1\n`tabContact`.customer=`tabCustomer`.name\nifnull(`tabContact`.is_primary_contact, 0)=1',
'add_tab': '`tabAddress`\n`tabContact`',
'columns': 'Customer\x01ID,Customer\x01Customer Name',
'criteria_name': 'Customer Address Contact',
'doc_type': 'Customer',
'add_col': u"`tabAddress`.address_line1 AS 'Address Line 1'\n`tabAddress`.address_line2 AS 'Address Line 2'\n`tabAddress`.city AS 'City'\n`tabAddress`.state AS 'State'\n`tabAddress`.pincode AS 'Pincode'\n`tabAddress`.country AS 'Country'\n`tabContact`.first_name AS 'Contact First Name'\n`tabContact`.last_name AS 'Contact Last Name'\n`tabContact`.phone AS 'Contact Phone'\n`tabContact`.mobile_no AS 'Contact Mobile'\n`tabContact`.email_id AS 'Contact Email'",
'add_cond': u'`tabAddress`.customer=`tabCustomer`.name\nifnull(`tabAddress`.is_primary_address, 0)=1\n`tabContact`.customer=`tabCustomer`.name\nifnull(`tabContact`.is_primary_contact, 0)=1',
'add_tab': u'`tabAddress`\n`tabContact`',
'columns': u'Customer\x01ID,Customer\x01Customer Name',
'criteria_name': u'Customer Address Contact',
'doc_type': u'Customer',
'doctype': 'Search Criteria',
'filters': "{'Customer\x01Saved':1,'Customer\x01Submitted':1}",
'module': 'Selling',
'filters': u"{'Customer\x01Saved':1,'Customer\x01Submitted':1}",
'module': u'Selling',
'name': '__common__',
'page_len': 50,
'sort_by': '`tabCustomer`.`customer_name`',
'sort_order': 'ASC',
'standard': 'Yes'
'sort_by': u'`tabCustomer`.`customer_name`',
'sort_order': u'ASC',
'standard': u'Yes'
},
# Search Criteria, customer_address_contact
{
'doctype': 'Search Criteria',
'name': 'customer_address_contact'
'name': u'customer_address_contact'
}
]

View File

@ -72,7 +72,7 @@ cur_frm.cscript.transaction = function(doc,cdt,cdn){
// System User Trigger
// -------------------
cur_frm.fields_dict['system_user'].get_query = function(doc) {
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.enabled = 1 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
}
@ -86,7 +86,7 @@ cur_frm.fields_dict['system_role'].get_query = function(doc) {
// Approving User Trigger
// -----------------------
cur_frm.fields_dict['approving_user'].get_query = function(doc) {
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.enabled = 1 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
}
@ -106,4 +106,4 @@ cur_frm.fields_dict['master_name'].get_query = function(doc){
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50';
else
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50';
}
}

View File

@ -3,91 +3,91 @@
# These values are common in all dictionaries
{
'creation': '2012-02-02 11:35:53',
'creation': '2012-02-13 11:28:48',
'docstatus': 0,
'modified': '2012-02-02 11:35:53',
'modified_by': 'Administrator',
'owner': 'Administrator'
'modified': '2012-02-13 11:28:48',
'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': 'Delivery Note-Packing Slip',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper'
'parent': u'Delivery Note-Packing Slip',
'parentfield': u'table_mapper_details',
'parenttype': u'DocType Mapper'
},
# These values are common for all Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'doctype': u'Field Mapper Detail',
'name': '__common__',
'parent': 'Delivery Note-Packing Slip',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper'
'parent': u'Delivery Note-Packing Slip',
'parentfield': u'field_mapper_details',
'parenttype': u'DocType Mapper'
},
# These values are common for all DocType Mapper
{
'doctype': u'DocType Mapper',
'from_doctype': 'Delivery Note',
'module': 'Stock',
'from_doctype': u'Delivery Note',
'module': u'Stock',
'name': '__common__',
'ref_doc_submitted': 1,
'to_doctype': 'Packing Slip'
'to_doctype': u'Packing Slip'
},
# DocType Mapper, Delivery Note-Packing Slip
{
'doctype': u'DocType Mapper',
'name': 'Delivery Note-Packing Slip'
'name': u'Delivery Note-Packing Slip'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'name',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'name',
'map': u'Yes',
'match_id': 0,
'to_field': 'delivery_note'
'to_field': u'delivery_note'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'qty',
'map': 'No',
'doctype': u'Field Mapper Detail',
'from_field': u'qty',
'map': u'No',
'match_id': 1,
'to_field': 'qty'
'to_field': u'qty'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'naming_series',
'map': 'No',
'doctype': u'Field Mapper Detail',
'from_field': u'naming_series',
'map': u'No',
'match_id': 0,
'to_field': 'naming_series'
'to_field': u'naming_series'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'from_table': 'Delivery Note',
'doctype': u'Table Mapper Detail',
'from_table': u'Delivery Note',
'match_id': 0,
'to_table': 'Packing Slip',
'validation_logic': 'docstatus=1'
'to_table': u'Packing Slip',
'validation_logic': u'docstatus=1'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'from_field': 'delivery_note_details',
'from_table': 'Delivery Note Detail',
'doctype': u'Table Mapper Detail',
'from_field': u'delivery_note_details',
'from_table': u'Delivery Note Detail',
'match_id': 1,
'to_field': 'item_details',
'to_table': 'Packing Slip Detail',
'validation_logic': 'IFNULL(packed_qty, 0) < IFNULL(qty, 0)'
'to_field': u'item_details',
'to_table': u'Packing Slip Detail',
'validation_logic': u'IFNULL(packed_qty, 0) < IFNULL(qty, 0)'
}
]

View File

@ -24,12 +24,13 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
// defined in sales_common.js
//cur_frm.cscript.update_item_details(doc, cdt, cdn);
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// defined in sales_common.js
//cur_frm.cscript.update_item_details(doc, cdt, cdn);
// load default charges
if(doc.__islocal && !getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length)
cur_frm.cscript.load_taxes(doc, cdt, cdn);