This commit is contained in:
Rushabh Mehta 2012-04-20 13:40:48 +05:30
commit 5bce61d58e
33 changed files with 275 additions and 265 deletions

View File

@ -86,13 +86,19 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
if(cint(doc.is_pos) == 1) { if(cint(doc.is_pos) == 1) {
hide_field(par_flds); hide_field(par_flds);
$(cur_frm.fields_dict.payments_section.row.wrapper).toggle(true);
$(cur_frm.fields_dict.advances.row.wrapper).toggle(false);
for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], false); for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], false);
for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], (doc.update_stock==1?true:false)); for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], (doc.update_stock==1?true:false));
} else { } else {
unhide_field(par_flds); unhide_field(par_flds);
$(cur_frm.fields_dict.payments_section.row.wrapper).toggle(false);
$(cur_frm.fields_dict.advances.row.wrapper).toggle(true);
for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], true); for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], true);
for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], false); for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], false);
} }
if (doc.docstatus==1) $(cur_frm.fields_dict.recurring_invoice.row.wrapper).toggle(true);
else $(cur_frm.fields_dict.recurring_invoice.row.wrapper).toggle(false);
// India related fields // India related fields
var cp = wn.control_panel; var cp = wn.control_panel;
@ -171,6 +177,7 @@ cur_frm.cscript.customer = function(doc,dt,dn,onload) {
get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1, get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,
function(doc, dt, dn) { function(doc, dt, dn) {
cur_frm.refresh(); cur_frm.refresh();
cur_frm.cscript.price_list_name(doc, dt, dn);
}); });
} }
@ -235,9 +242,21 @@ cur_frm.cscript.debit_to = function(doc,dt,dn) {
//refresh advance amount //refresh advance amount
//------------------------------------------------- //-------------------------------------------------
cur_frm.cscript.paid_amount = function(doc,dt,dn){
cur_frm.cscript.write_off_outstanding_amount_automatically = function(doc) {
if (doc.write_off_outstanding_amount_automatically == 1)
doc.write_off_amount = flt(doc.grand_total) - flt(doc.paid_amount);
doc.outstanding_amount = flt(doc.grand_total) - flt(doc.paid_amount) - flt(doc.write_off_amount); doc.outstanding_amount = flt(doc.grand_total) - flt(doc.paid_amount) - flt(doc.write_off_amount);
refresh_field('outstanding_amount'); refresh_field(['write_off_amount', 'outstanding_amount']);
}
cur_frm.cscript.paid_amount = function(doc) {
cur_frm.cscript.write_off_outstanding_amount_automatically(doc);
}
cur_frm.cscript.write_off_amount = function(doc) {
cur_frm.cscript.write_off_outstanding_amount_automatically(doc);
} }

View File

@ -126,7 +126,6 @@ class DocType(TransactionBase):
if self.doc.debit_to: if self.doc.debit_to:
self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name') self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
# get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 0)
# Pull Details of Delivery Note or Sales Order Selected # Pull Details of Delivery Note or Sales Order Selected
@ -467,8 +466,6 @@ class DocType(TransactionBase):
sales_com_obj.validate_max_discount(self, 'entries') #verify whether rate is not greater than tolerance sales_com_obj.validate_max_discount(self, 'entries') #verify whether rate is not greater than tolerance
sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100% sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100%
sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date') sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
if not self.doc.customer:
get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 0)
self.validate_customer() self.validate_customer()
self.validate_debit_to_acc() self.validate_debit_to_acc()
self.validate_debit_acc() self.validate_debit_acc()

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-04-11 13:17:25', 'creation': '2012-04-13 11:56:18',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-04-13 11:26:44', 'modified': '2012-04-20 11:52:36',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -27,7 +27,7 @@
'server_code_error': u' ', 'server_code_error': u' ',
'show_in_menu': 0, 'show_in_menu': 0,
'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding', 'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
'version': 418 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -580,23 +580,6 @@
'trigger': u'Client' 'trigger': u'Client'
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break1',
'fieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break3',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField # DocField
{ {
'description': u'Will be calculated automatically when you enter the details', 'description': u'Will be calculated automatically when you enter the details',
@ -611,83 +594,6 @@
'reqd': 1 'reqd': 1
}, },
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.is_pos==1',
'doctype': u'DocField',
'fieldname': u'cash_bank_account',
'fieldtype': u'Link',
'label': u'Cash/Bank Account',
'oldfieldname': u'cash_bank_account',
'oldfieldtype': u'Link',
'options': u'Account',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.is_pos==1',
'doctype': u'DocField',
'fieldname': u'paid_amount',
'fieldtype': u'Currency',
'label': u'Paid Amount',
'oldfieldname': u'paid_amount',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break4',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.is_pos==1',
'doctype': u'DocField',
'fieldname': u'write_off_account',
'fieldtype': u'Link',
'label': u'Write Off Account',
'options': u'Account',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.is_pos==1',
'doctype': u'DocField',
'fieldname': u'write_off_cost_center',
'fieldtype': u'Link',
'label': u'Write Off Cost Center',
'options': u'Cost Center',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.is_pos==1',
'doctype': u'DocField',
'fieldname': u'write_off_amount',
'fieldtype': u'Currency',
'label': u'Write Off Amount',
'permlevel': 0,
'print_hide': 1
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',
@ -938,6 +844,109 @@
'print_hide': 1 'print_hide': 1
}, },
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'payments_section',
'fieldtype': u'Section Break',
'label': u'Payments',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'column_break3',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'paid_amount',
'fieldtype': u'Currency',
'label': u'Paid Amount',
'oldfieldname': u'paid_amount',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'cash_bank_account',
'fieldtype': u'Link',
'label': u'Cash/Bank Account',
'oldfieldname': u'cash_bank_account',
'oldfieldtype': u'Link',
'options': u'Account',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'column_break4',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'write_off_outstanding_amount_automatically',
'fieldtype': u'Check',
'label': u'Write Off Outstanding Amount Automatically',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'write_off_amount',
'fieldtype': u'Currency',
'label': u'Write Off Amount',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'write_off_account',
'fieldtype': u'Link',
'label': u'Write Off Account',
'options': u'Account',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'write_off_cost_center',
'fieldtype': u'Link',
'label': u'Write Off Cost Center',
'options': u'Cost Center',
'permlevel': 0,
'print_hide': 1
},
# DocField # DocField
{ {
'colour': u'White:FFF', 'colour': u'White:FFF',
@ -1232,7 +1241,6 @@
# DocField # DocField
{ {
'colour': u'White:FFF', 'colour': u'White:FFF',
'depends_on': u'eval:!doc.is_pos',
'doctype': u'DocField', 'doctype': u'DocField',
'fieldname': u'advances', 'fieldname': u'advances',
'fieldtype': u'Section Break', 'fieldtype': u'Section Break',
@ -1369,7 +1377,7 @@
# DocField # DocField
{ {
'depends_on': u'eval:doc.docstatus==1', 'colour': u'White:FFF',
'doctype': u'DocField', 'doctype': u'DocField',
'fieldname': u'recurring_invoice', 'fieldname': u'recurring_invoice',
'fieldtype': u'Section Break', 'fieldtype': u'Section Break',

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:07', 'creation': '2012-04-13 11:56:26',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 18:47:38', 'modified': '2012-04-19 17:12:24',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -27,7 +27,7 @@
'show_in_menu': 0, 'show_in_menu': 0,
'subject': u'eval:"%(customer_name)s"=="%(name)s" ? "" : "%(customer_name)s"', 'subject': u'eval:"%(customer_name)s"=="%(name)s" ? "" : "%(customer_name)s"',
'tag_fields': u'customer_group,customer_type', 'tag_fields': u'customer_group,customer_type',
'version': 435 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -57,6 +57,46 @@
'name': u'Customer' 'name': u'Customer'
}, },
# 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,
@ -77,46 +117,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
{ {
'colour': u'White:FFF', 'colour': u'White:FFF',
@ -340,6 +340,16 @@
'search_index': 1 'search_index': 1
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'default_price_list',
'fieldtype': u'Link',
'label': u'Default Price List',
'options': u'Price List',
'permlevel': 0
},
# DocField # DocField
{ {
'colour': u'White:FFF', 'colour': u'White:FFF',

View File

@ -98,6 +98,7 @@ cur_frm.cscript.customer = function(doc,dt,dn) {
var callback = function(r,rt) { var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname]; var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh(); cur_frm.refresh();
cur_frm.cscript.price_list_name(doc, dt, dn);
} }
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name),

View File

@ -76,24 +76,6 @@ cur_frm.cscript.update_item_details = function(doc, dt, dn, callback) {
} }
// ============== Customer and its primary contact Details ============================
cur_frm.cscript.customer = function(doc, cdt, cdn) {
if(doc.customer){
if (!doc.company) {
msgprint("Please select company to proceed");
doc.customer = '';
refresh_field('customer');
} else {
var callback = function(r, rt){
cur_frm.refresh();
}
$c_obj(make_doclist(doc.doctype, doc.name), 'get_customer_details', '',callback);
}
}
}
var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) { var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
//parent flds //parent flds
par_cols_base = {'net_total': 'Net Total', 'other_charges_total': 'Taxes and Charges Total', par_cols_base = {'net_total': 'Net Total', 'other_charges_total': 'Taxes and Charges Total',

View File

@ -120,24 +120,6 @@ class DocType(TransactionBase):
obj.doc.debit_to = acc_head and acc_head[0][0] or '' obj.doc.debit_to = acc_head and acc_head[0][0] or ''
# Get Customer Details along with its primary contact details
# ==============================================================
def get_customer_details(self, obj = '', inv_det_reqd = 1):
details = webnotes.conn.sql("select customer_name,address, territory, customer_group, default_sales_partner, default_commission_rate from `tabCustomer` where name = '%s' and docstatus != 2" %(obj.doc.customer), as_dict = 1)
obj.doc.customer_name = details and details[0]['customer_name'] or ''
obj.doc.customer_address = details and details[0]['address'] or ''
obj.doc.territory = details and details[0]['territory'] or ''
obj.doc.customer_group = details and details[0]['customer_group'] or ''
obj.doc.sales_partner = details and details[0]['default_sales_partner'] or ''
obj.doc.commission_rate = details and flt(details[0]['default_commission_rate']) or ''
if obj.doc.doctype != 'Sales Invoice':
obj.doc.delivery_address = details and details[0]['address'] or ''
self.get_contact_details(obj,primary = 1) # get primary contact details
self.get_sales_person_details(obj) # get default sales person details
if obj.doc.doctype == 'Sales Invoice' and inv_det_reqd:
self.get_invoice_details(obj) # get invoice details
# Get Item Details # Get Item Details
# =============================================================== # ===============================================================

View File

@ -99,6 +99,8 @@ cur_frm.cscript.customer = function(doc,dt,dn) {
var callback2 = function(r, rt) { var callback2 = function(r, rt) {
if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']); if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']);
cur_frm.refresh(); cur_frm.refresh();
cur_frm.cscript.price_list_name(doc, dt, dn);
} }
var doc = locals[cur_frm.doctype][cur_frm.docname]; var doc = locals[cur_frm.doctype][cur_frm.docname];
get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2); get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2);

View File

@ -74,13 +74,6 @@ class DocType(TransactionBase):
get_obj('DocType Mapper', 'Project-Sales Order').dt_map('Project', 'Sales Order', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Order']]") get_obj('DocType Mapper', 'Project-Sales Order').dt_map('Project', 'Sales Order', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Order']]")
# Get Customer Details
# ---------------------
#def get_customer_details(self):
# sales_com_obj = get_obj('Sales Common')
# sales_com_obj.get_customer_details(self)
# sales_com_obj.get_shipping_details(self)
# Get contact person details based on customer selected # Get contact person details based on customer selected
# ------------------------------------------------------ # ------------------------------------------------------
def get_contact_details(self): def get_contact_details(self):

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:19', 'creation': '2012-04-13 11:56:30',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 14:36:19', 'modified': '2012-04-19 17:50:43',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -26,7 +26,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': 34 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -56,6 +56,56 @@
'name': u'Customer Group' 'name': u'Customer Group'
}, },
# 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,
@ -66,56 +116,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',
@ -182,6 +182,16 @@
'reqd': 1 'reqd': 1
}, },
# DocField
{
'doctype': u'DocField',
'fieldname': u'default_price_list',
'fieldtype': u'Link',
'label': u'Default Price List',
'options': u'Price List',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': u'DocField', 'doctype': u'DocField',

View File

@ -79,6 +79,7 @@ cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var doc = locals[cur_frm.doctype][cur_frm.docname]; var doc = locals[cur_frm.doctype][cur_frm.docname];
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']); if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
cur_frm.refresh(); cur_frm.refresh();
cur_frm.cscript.price_list_name(doc, dt, dn);
} }
var args = onload ? 'onload':'' 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) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback);

View File

@ -18,7 +18,7 @@
'colour': u'White:FFF', 'colour': u'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'in_create': 1, 'in_create': 1,
'module': u'Knowledge Base', 'module': u'Utilities',
'name': '__common__', 'name': '__common__',
'read_only': 1, 'read_only': 1,
'section_style': u'Simple', 'section_style': u'Simple',

View File

@ -18,7 +18,7 @@
'colour': u'White:FFF', 'colour': u'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'in_create': 1, 'in_create': 1,
'module': u'Knowledge Base', 'module': u'Utilities',
'name': '__common__', 'name': '__common__',
'read_only': 1, 'read_only': 1,
'section_style': u'Simple', 'section_style': u'Simple',

View File

@ -56,7 +56,7 @@ KBItemToolbar = function(args, kb) {
console.log(1); console.log(1);
this.innerHTML = 'deleting...'; this.innerHTML = 'deleting...';
this.disabled = 1; this.disabled = 1;
$c_page('knowledge_base', 'questions', 'delete', { $c_page('utilities', 'questions', 'delete', {
dt: me.doctype, dn: me.det.name}, function(r,rt) { dt: me.doctype, dn: me.det.name}, function(r,rt) {
// reload the list // reload the list
kb.list.run() kb.list.run()
@ -112,7 +112,7 @@ EditableText = function(args) {
} }
var btn = this; var btn = this;
$(btn).set_working(); $(btn).set_working();
$c_page('knowledge_base', 'question_view', 'update_item', { $c_page('utilities', 'question_view', 'update_item', {
dt: me.dt, dn: me.dn, fn: me.fieldname, text: v dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
}, },
function(r) { function(r) {

View File

@ -65,7 +65,7 @@ KBQuestionView = function(w, qid, qtext) {
// check if users has answered // check if users has answered
// (if no) then add a box to add a new answer // (if no) then add a box to add a new answer
this.make_add_answer = function() { this.make_add_answer = function() {
$c_page('knowledge_base', 'question_view', 'has_answered', qid, function(r, rt) { $c_page('utilities', 'question_view', 'has_answered', qid, function(r, rt) {
if(r.message=='No') { if(r.message=='No') {
me.make_answer_box_link(); me.make_answer_box_link();
} }
@ -92,7 +92,7 @@ KBQuestionView = function(w, qid, qtext) {
var v = wn.tinymce.get_value(me.input); var v = wn.tinymce.get_value(me.input);
if(!v) { msgprint('Write something!'); return; } if(!v) { msgprint('Write something!'); return; }
me.btn.set_working(); me.btn.set_working();
$c_page('knowledge_base', 'question_view', 'add_answer', {qid: qid, answer:v}, $c_page('utilities', 'question_view', 'add_answer', {qid: qid, answer:v},
function(r, rt) { function(r, rt) {
me.btn.done_working(); me.btn.done_working();
me.ans_list.list.run(); me.ans_list.list.run();
@ -107,7 +107,7 @@ KBQuestionView = function(w, qid, qtext) {
this.make(); this.make();
} }
else { else {
$c_page('knowledge_base', 'question_view', 'get_question', qid, function(r, rt) { $c_page('utilities', 'question_view', 'get_question', qid, function(r, rt) {
qtext = r.message; qtext = r.message;
me.make(); me.make();
}); });
@ -185,4 +185,4 @@ KBAnswer = function(body, data, ans_list) {
} }
wn.require('erpnext/knowledge_base/page/kb_common/kb_common.js'); wn.require('erpnext/utilities/page/kb_common/kb_common.js');

View File

@ -13,7 +13,7 @@
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', 'doctype': 'Page',
'module': 'Knowledge Base', 'module': 'Utilities',
'name': '__common__', 'name': '__common__',
'page_name': 'Question View', 'page_name': 'Question View',
'standard': 'Yes' 'standard': 'Yes'

View File

@ -88,7 +88,7 @@ function KnowledgeBase(w) {
// add a new question to the database // add a new question to the database
this.add_question = function(suggest_list) { this.add_question = function(suggest_list) {
$c_page('knowledge_base', 'questions', 'add_question', { $c_page('utilities', 'questions', 'add_question', {
question: this.search.value, question: this.search.value,
suggest: suggest_list suggest: suggest_list
}, function(r,rt) { }, function(r,rt) {
@ -219,4 +219,4 @@ KBQuestion = function(parent, det, kb) {
this.make() this.make()
} }
wn.require('erpnext/knowledge_base/page/kb_common/kb_common.js'); wn.require('erpnext/utilities/page/kb_common/kb_common.js');

View File

@ -13,7 +13,7 @@
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', 'doctype': 'Page',
'module': 'Knowledge Base', 'module': 'Utilities',
'name': '__common__', 'name': '__common__',
'page_name': 'Questions', 'page_name': 'Questions',
'standard': 'Yes' 'standard': 'Yes'

View File

@ -34,8 +34,8 @@ class TransactionBase:
self.doc.contact_email = contact_email or '' self.doc.contact_email = contact_email or ''
self.doc.contact_mobile = contact_mobile or '' self.doc.contact_mobile = contact_mobile or ''
self.get_customer_details(self.doc.customer)
if args != 'onload': if args != 'onload':
self.get_customer_details(self.doc.customer)
self.get_sales_person(self.doc.customer) self.get_sales_person(self.doc.customer)
# Get Customer Default Shipping Address - first load # Get Customer Default Shipping Address - first load
@ -50,8 +50,8 @@ class TransactionBase:
self.doc.contact_email = contact_email or '' self.doc.contact_email = contact_email or ''
self.doc.contact_mobile = contact_mobile or '' self.doc.contact_mobile = contact_mobile or ''
self.get_customer_details(self.doc.customer)
if self.doc.doctype != 'Quotation' and args != 'onload': if self.doc.doctype != 'Quotation' and args != 'onload':
self.get_customer_details(self.doc.customer)
self.get_sales_person(self.doc.customer) self.get_sales_person(self.doc.customer)
# Get Customer Address # Get Customer Address
@ -118,13 +118,18 @@ class TransactionBase:
# Get Customer Details # Get Customer Details
# ----------------------- # -----------------------
def get_customer_details(self, name): def get_customer_details(self, name):
customer_details = webnotes.conn.sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1) customer_details = webnotes.conn.sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate, default_price_list from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1)
if customer_details: if customer_details:
self.doc.customer_name = customer_details[0]['customer_name'] or '' self.doc.customer_name = customer_details[0]['customer_name'] or ''
self.doc.customer_group = customer_details[0]['customer_group'] or '' self.doc.customer_group = customer_details[0]['customer_group'] or ''
self.doc.territory = customer_details[0]['territory'] or '' self.doc.territory = customer_details[0]['territory'] or ''
self.doc.sales_partner = customer_details[0]['default_sales_partner'] or '' self.doc.sales_partner = customer_details[0]['default_sales_partner'] or ''
self.doc.commission_rate = customer_details[0]['default_commission_rate'] or '' self.doc.commission_rate = customer_details[0]['default_commission_rate'] or ''
def_price_list = customer_details[0]['default_price_list'] or ''
if not def_price_list:
cg_price_list = webnotes.conn.sql("select default_price_list from `tabCustomer Group` where name = %s", customer_details[0]['customer_group'])
def_price_list = cg_price_list and cg_price_list[0][0] or ''
self.doc.price_list_name = def_price_list or self.doc.price_list_name
# Get Customer Shipping Address # Get Customer Shipping Address
# ----------------------- # -----------------------