mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-03 16:40:19 +00:00
Merge branch '4.0.0-wip' of github.com:webnotes/erpnext into 4.0-hotfix
This commit is contained in:
@@ -2,27 +2,21 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.provide("erpnext.support");
|
||||
// TODO commonify this code
|
||||
|
||||
wn.ui.form.on_change("Customer Issue", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
wn.ui.form.on_change("Customer Issue", "customer_address",
|
||||
erpnext.utils.get_address_display);
|
||||
wn.ui.form.on_change("Customer Issue", "contact_person",
|
||||
erpnext.utils.get_contact_details);
|
||||
|
||||
erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
|
||||
refresh: function() {
|
||||
if((cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) {
|
||||
cur_frm.add_custom_button(wn._('Make Maintenance Visit'), this.make_maintenance_visit)
|
||||
}
|
||||
},
|
||||
|
||||
customer: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.customer) {
|
||||
// TODO shift this to depends_on
|
||||
unhide_field(['customer_address', 'contact_person']);
|
||||
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "set_customer_defaults",
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
make_maintenance_visit: function() {
|
||||
wn.model.open_mapped_doc({
|
||||
method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit",
|
||||
@@ -35,16 +29,7 @@ $.extend(cur_frm.cscript, new erpnext.support.CustomerIssue({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
if(!doc.status)
|
||||
set_multiple(dt,dn,{status:'Open'});
|
||||
if(doc.__islocal){
|
||||
hide_field(['customer_address','contact_person']);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
if(doc.customer)
|
||||
return get_server_fields('get_customer_address',
|
||||
JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||
set_multiple(dt,dn,{status:'Open'});
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
@@ -82,6 +67,8 @@ cur_frm.add_fetch('serial_no', 'amc_expiry_date', 'amc_expiry_date');
|
||||
cur_frm.add_fetch('serial_no', 'customer', 'customer');
|
||||
cur_frm.add_fetch('serial_no', 'customer_name', 'customer_name');
|
||||
cur_frm.add_fetch('serial_no', 'delivery_address', 'customer_address');
|
||||
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
|
||||
cur_frm.add_fetch('item_code', 'description', 'description');
|
||||
|
||||
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
||||
if(doc.serial_no) {
|
||||
@@ -98,8 +85,6 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
|
||||
cur_frm.add_fetch('item_code', 'description', 'description');
|
||||
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
|
||||
@@ -276,6 +276,7 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_name",
|
||||
"fieldtype": "Data",
|
||||
@@ -283,6 +284,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_group",
|
||||
@@ -293,6 +295,7 @@
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "territory",
|
||||
@@ -307,10 +310,27 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "address_display",
|
||||
"fieldname": "contact_display",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Address",
|
||||
"label": "Contact",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_mobile",
|
||||
"fieldtype": "Data",
|
||||
"label": "Mobile No",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Data",
|
||||
"label": "Contact Email",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@@ -320,27 +340,8 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_display",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Contact",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_mobile",
|
||||
"fieldtype": "Data",
|
||||
"label": "Mobile No",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Data",
|
||||
"label": "Contact Email",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"description": "If different than customer address",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "service_address",
|
||||
"fieldtype": "Small Text",
|
||||
@@ -348,6 +349,15 @@
|
||||
"oldfieldname": "service_address",
|
||||
"oldfieldtype": "Small Text"
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "address_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"label": "Address",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "more_info",
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.provide("erpnext.support");
|
||||
|
||||
wn.ui.form.on_change("Maintenance Schedule", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
wn.ui.form.on_change("Maintenance Schedule", "customer_address",
|
||||
erpnext.utils.get_address_display);
|
||||
wn.ui.form.on_change("Maintenance Schedule", "contact_person",
|
||||
erpnext.utils.get_contact_details);
|
||||
|
||||
// TODO commonify this code
|
||||
erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
|
||||
refresh: function() {
|
||||
@@ -30,36 +38,16 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
|
||||
});
|
||||
}
|
||||
},
|
||||
customer: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.customer) {
|
||||
return this.frm.call({
|
||||
doc: me.frm.doc,
|
||||
method: "set_customer_defaults",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$.extend(cur_frm.cscript, new erpnext.support.MaintenanceSchedule({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
if (!doc.status)
|
||||
set_multiple(dt, dn, { status:'Draft' });
|
||||
|
||||
if (doc.__islocal) {
|
||||
set_multiple(dt, dn, { transaction_date:get_today() });
|
||||
hide_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) {
|
||||
return get_server_fields('get_customer_address',
|
||||
JSON.stringify({customer: doc.customer, address: doc.customer_address,
|
||||
contact: doc.contact_person}), '', doc, dt, dn, 1);
|
||||
}
|
||||
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
||||
|
||||
if(doc.__islocal){
|
||||
set_multiple(dt,dn,{transaction_date:get_today()});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
|
||||
@@ -54,12 +54,6 @@
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-user"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer",
|
||||
@@ -76,83 +70,10 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_address",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer Address",
|
||||
"options": "Address",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_person",
|
||||
"fieldtype": "Link",
|
||||
"label": "Contact Person",
|
||||
"options": "Contact",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Customer Name",
|
||||
"oldfieldname": "customer_name",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "address_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Address",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Contact",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_mobile",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Mobile No",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Contact Email",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Transaction Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"oldfieldtype": "Date",
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"default": "Draft",
|
||||
"doctype": "DocField",
|
||||
@@ -170,49 +91,15 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Data",
|
||||
"ignore_restrictions": 1,
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "amended_from",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"label": "Transaction Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"oldfieldtype": "Date",
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "territory",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Territory",
|
||||
"oldfieldname": "territory",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Territory",
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_group",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer Group",
|
||||
"options": "Customer Group",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "items",
|
||||
@@ -255,6 +142,120 @@
|
||||
"options": "Maintenance Schedule Detail",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_info",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Contact Info"
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Customer Name",
|
||||
"oldfieldname": "customer_name",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_person",
|
||||
"fieldtype": "Link",
|
||||
"label": "Contact Person",
|
||||
"options": "Contact",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_mobile",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Mobile No",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Contact Email",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Contact",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_17",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_address",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer Address",
|
||||
"options": "Address",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "address_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Address",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "territory",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Territory",
|
||||
"oldfieldname": "territory",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Territory",
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_group",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer Group",
|
||||
"options": "Customer Group",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.provide("erpnext.support");
|
||||
|
||||
wn.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
wn.ui.form.on_change("Maintenance Visit", "customer_address",
|
||||
erpnext.utils.get_address_display);
|
||||
wn.ui.form.on_change("Maintenance Visit", "contact_person",
|
||||
erpnext.utils.get_contact_details);
|
||||
|
||||
// TODO commonify this code
|
||||
erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
|
||||
refresh: function() {
|
||||
@@ -44,20 +52,7 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
|
||||
})
|
||||
});
|
||||
}
|
||||
cur_frm.cscript.hide_contact_info();
|
||||
},
|
||||
customer: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.customer) {
|
||||
// TODO shift this to depends_on
|
||||
cur_frm.cscript.hide_contact_info();
|
||||
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "set_customer_defaults",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$.extend(cur_frm.cscript, new erpnext.support.MaintenanceVisit({frm: cur_frm}));
|
||||
@@ -65,15 +60,6 @@ $.extend(cur_frm.cscript, new erpnext.support.MaintenanceVisit({frm: cur_frm}));
|
||||
cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
||||
if(doc.__islocal) set_multiple(dt,dn,{mntc_date:get_today()});
|
||||
cur_frm.cscript.hide_contact_info();
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_contact_info = function() {
|
||||
cur_frm.toggle_display("contact_info_section", cur_frm.doc.customer ? true : false);
|
||||
}
|
||||
|
||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
|
||||
@@ -269,6 +269,7 @@
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_info_section",
|
||||
"fieldtype": "Section Break",
|
||||
|
||||
@@ -5,20 +5,8 @@ cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return{ query: "erpnext.controllers.queries.customer_query" } }
|
||||
|
||||
wn.provide("erpnext.support");
|
||||
// TODO commonify this code
|
||||
erpnext.support.SupportTicket = wn.ui.form.Controller.extend({
|
||||
customer: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.customer) {
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "set_customer_defaults",
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.extend(cur_frm.cscript, new erpnext.support.SupportTicket({frm: cur_frm}));
|
||||
cur_frm.add_fetch("customer", "customer_name", "customer_name")
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function(doc, dt, dn) {
|
||||
|
||||
Reference in New Issue
Block a user