[contact/address] fixed auto setting closes #475 (erpnext)
This commit is contained in:
parent
1475e4d295
commit
37982a6a1f
@ -71,17 +71,6 @@ cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc
|
|||||||
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
||||||
|
|
||||||
cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
||||||
|
@ -56,17 +56,6 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
|||||||
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||||
|
@ -49,19 +49,6 @@ cur_frm.cscript.make_address = function() {
|
|||||||
parent: cur_frm.fields_dict['address_html'].wrapper,
|
parent: cur_frm.fields_dict['address_html'].wrapper,
|
||||||
page_length: 5,
|
page_length: 5,
|
||||||
new_doctype: "Address",
|
new_doctype: "Address",
|
||||||
custom_new_doc: function(doctype) {
|
|
||||||
var address = wn.model.make_new_doc_and_get_name('Address');
|
|
||||||
address = locals['Address'][address];
|
|
||||||
address.supplier = cur_frm.doc.name;
|
|
||||||
address.supplier_name = cur_frm.doc.supplier_name;
|
|
||||||
address.address_title = cur_frm.doc.supplier_name;
|
|
||||||
|
|
||||||
if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) {
|
|
||||||
address.address_type = "Office";
|
|
||||||
}
|
|
||||||
|
|
||||||
wn.set_route("Form", "Address", address.name);
|
|
||||||
},
|
|
||||||
get_query: function() {
|
get_query: function() {
|
||||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||||
},
|
},
|
||||||
@ -80,13 +67,6 @@ cur_frm.cscript.make_contact = function() {
|
|||||||
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
||||||
page_length: 5,
|
page_length: 5,
|
||||||
new_doctype: "Contact",
|
new_doctype: "Contact",
|
||||||
custom_new_doc: function(doctype) {
|
|
||||||
var contact = wn.model.make_new_doc_and_get_name('Contact');
|
|
||||||
contact = locals['Contact'][contact];
|
|
||||||
contact.supplier = cur_frm.doc.name;
|
|
||||||
contact.supplier_name = cur_frm.doc.supplier_name;
|
|
||||||
wn.set_route("Form", "Contact", contact.name);
|
|
||||||
},
|
|
||||||
get_query: function() {
|
get_query: function() {
|
||||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||||
},
|
},
|
||||||
|
@ -87,13 +87,3 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
|||||||
department, designation FROM tabContact WHERE supplier = \"" + doc.supplier
|
department, designation FROM tabContact WHERE supplier = \"" + doc.supplier
|
||||||
+"\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50";
|
+"\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50";
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
27
controllers/js/contact_address_common.js
Normal file
27
controllers/js/contact_address_common.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
||||||
|
cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
||||||
|
|
||||||
|
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||||
|
cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query;
|
||||||
|
|
||||||
|
if(doc.__islocal) {
|
||||||
|
var last_route = wn.route_history.slice(-2, -1)[0];
|
||||||
|
if(last_route && last_route[0]==="Form") {
|
||||||
|
if(["Customer", "Quotation", "Sales Order", "Sales Invoice", "Delivery Note",
|
||||||
|
"Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit",
|
||||||
|
"Maintenance Schedule"]
|
||||||
|
.indexOf(last_route[1])!==-1) {
|
||||||
|
var refdoc = wn.model.get_doc(last_route[1], last_route[2]);
|
||||||
|
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
|
||||||
|
cur_frm.set_value("customer_name", refdoc.customer_name);
|
||||||
|
}
|
||||||
|
if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
|
||||||
|
.indexOf(last_route[1])!==-1) {
|
||||||
|
var customer = wn.model.get_doc(last_route[1], last_route[2]);
|
||||||
|
cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
|
||||||
|
cur_frm.set_value("supplier_name", refdoc.supplier_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -32,6 +32,8 @@ For each company, Chart of Accounts signifies the way to classify the accounting
|
|||||||
|
|
||||||
Let us understand the main groups of the Chart of Accounts.
|
Let us understand the main groups of the Chart of Accounts.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Balance Sheet Accounts
|
### Balance Sheet Accounts
|
||||||
|
|
||||||
The Balance Sheet has Application of Funds (Assets) and Sources of Funds (Liabilities) that signify the net-worth of your company at any given time. When you begin or end a financial period, all the Assets are equal to the Liabilities.
|
The Balance Sheet has Application of Funds (Assets) and Sources of Funds (Liabilities) that signify the net-worth of your company at any given time. When you begin or end a financial period, all the Assets are equal to the Liabilities.
|
||||||
@ -60,6 +62,8 @@ Accounting Transactions can only be made against Ledger Accounts (not Groups)
|
|||||||
|
|
||||||
> Note: An Account “Ledger” is also sometimes called as Account “Head”.
|
> Note: An Account “Ledger” is also sometimes called as Account “Head”.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Other Account Types
|
### Other Account Types
|
||||||
|
|
||||||
In ERPNext, you can also specify more information when you create a new Account, this is there to help you select that particular account in a scenario like Bank Account or a Tax Account and has no affect on the Chart itself.
|
In ERPNext, you can also specify more information when you create a new Account, this is there to help you select that particular account in a scenario like Bank Account or a Tax Account and has no affect on the Chart itself.
|
||||||
@ -70,6 +74,8 @@ You can also tag if an account represents a Customer, Supplier or Employee in "M
|
|||||||
|
|
||||||
To create new Accounts, explore your Chart of Accounts and click on an Account group under which you want to create the new Account. On the right side, you will see a options to “Edit” or “Add” a new Account.
|
To create new Accounts, explore your Chart of Accounts and click on an Account group under which you want to create the new Account. On the right side, you will see a options to “Edit” or “Add” a new Account.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Option to create will only appear if you click on a Group (folder) type Account.
|
Option to create will only appear if you click on a Group (folder) type Account.
|
||||||
|
|
||||||
ERPNext creates a standard structure for you when the Company is created but it is up to you to modify or add or remove accounts.
|
ERPNext creates a standard structure for you when the Company is created but it is up to you to modify or add or remove accounts.
|
||||||
@ -80,52 +86,3 @@ Typically, you might want to create Accounts for
|
|||||||
- Taxes (VAT, Sales Tax etc based on your country) under Current Liabilities.
|
- Taxes (VAT, Sales Tax etc based on your country) under Current Liabilities.
|
||||||
- Types of Sales (for example, Product Sales, Service Sales etc.) under Income.
|
- Types of Sales (for example, Product Sales, Service Sales etc.) under Income.
|
||||||
- Types of Assets (building, machinery, furniture etc.) under Fixed Assets.
|
- Types of Assets (building, machinery, furniture etc.) under Fixed Assets.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Chart of Cost Centers
|
|
||||||
|
|
||||||
Your Chart of Accounts is mainly for reporting your information for governmental purposes and less for how you business actually performs. Though you can tweak it a bit to resemble your business.
|
|
||||||

|
|
||||||
Most businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the Chart of Cost Centers.
|
|
||||||
|
|
||||||
You can create a tree of Cost Centers to represent your business better. Each Income / Expense entry is also tagged against a Cost Center.
|
|
||||||
|
|
||||||
For example, if you have two types of sales:
|
|
||||||
|
|
||||||
- Walk-in Sales
|
|
||||||
- Online Sales
|
|
||||||
|
|
||||||
You may not have shipping expenses for your walk-in customers, and no shop-rent for your online customers. If you want to get the profitability of each of these separately, you create the two as Cost Centers and you can mark all sales as either "Walk-in" or "Online" and also all your purchases in the same way.
|
|
||||||
|
|
||||||
So when you do your analysis you can get a better idea which side of your business is doing better. Since ERPNext has option to add multiple Companies, you can create Cost Centers for each Company and manage it separately.
|
|
||||||
|
|
||||||
To setup your Chart of Cost Centers go to:
|
|
||||||
|
|
||||||
> Accounts > Chart of Cost Centers
|
|
||||||
|
|
||||||
Cost centers help you in one more activity, budgeting.
|
|
||||||
|
|
||||||
### Budgeting
|
|
||||||
|
|
||||||
ERPNext will help you set and manage budgets on your Cost Centers. This is useful when, for example, you are doing online sales and you have a budget for search ads and you want ERPNext to stop or warn you from over spending based on that budget.
|
|
||||||
|
|
||||||
Budgets are also great for planning purposes. When you are making your plans for the next financial year, you would typically target a revenue and based on that you would set your expenses. Setting a budget will ensure that your expenses do not get out of hand at any point based on your plans.
|
|
||||||
|
|
||||||
You can define it in the Cost Center. If you have seasonal sales you can also define a budget distribution that the budget will follow.
|
|
||||||

|
|
||||||
#### Budget Actions
|
|
||||||
|
|
||||||
ERPNext allows you to either:
|
|
||||||
|
|
||||||
- Stop.
|
|
||||||
- Warn or,
|
|
||||||
- Ignore
|
|
||||||
|
|
||||||
if you exceed budgets.
|
|
||||||
|
|
||||||
These can be defined from the Company record.
|
|
||||||
|
|
||||||
Even if you choose to “ignore” budget overruns, you will get a wealth of information from the “Budget vs Actual” variance report.
|
|
||||||
|
|
||||||
> Note: When you set a budget, it has to be set per Account under the Cost Center. For example if you have a Cost Center “Online Sales”, you can restrict “Advertising Budget” by creating a row with that Account and defining the amount.
|
|
54
docs/docs.user.setup.cost_centers.md
Normal file
54
docs/docs.user.setup.cost_centers.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
{
|
||||||
|
"_label": "Cost Centers and Budgeting",
|
||||||
|
"_links": [
|
||||||
|
"docs.user.accounts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
---
|
||||||
|
## Chart of Cost Centers
|
||||||
|
|
||||||
|
Your Chart of Accounts is mainly for reporting your information for governmental purposes and less for how you business actually performs. Though you can tweak it a bit to resemble your business.
|
||||||
|

|
||||||
|
Most businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the Chart of Cost Centers.
|
||||||
|
|
||||||
|
You can create a tree of Cost Centers to represent your business better. Each Income / Expense entry is also tagged against a Cost Center.
|
||||||
|
|
||||||
|
For example, if you have two types of sales:
|
||||||
|
|
||||||
|
- Walk-in Sales
|
||||||
|
- Online Sales
|
||||||
|
|
||||||
|
You may not have shipping expenses for your walk-in customers, and no shop-rent for your online customers. If you want to get the profitability of each of these separately, you create the two as Cost Centers and you can mark all sales as either "Walk-in" or "Online" and also all your purchases in the same way.
|
||||||
|
|
||||||
|
So when you do your analysis you can get a better idea which side of your business is doing better. Since ERPNext has option to add multiple Companies, you can create Cost Centers for each Company and manage it separately.
|
||||||
|
|
||||||
|
To setup your Chart of Cost Centers go to:
|
||||||
|
|
||||||
|
> Accounts > Chart of Cost Centers
|
||||||
|
|
||||||
|
Cost centers help you in one more activity, budgeting.
|
||||||
|
|
||||||
|
### Budgeting
|
||||||
|
|
||||||
|
ERPNext will help you set and manage budgets on your Cost Centers. This is useful when, for example, you are doing online sales and you have a budget for search ads and you want ERPNext to stop or warn you from over spending based on that budget.
|
||||||
|
|
||||||
|
Budgets are also great for planning purposes. When you are making your plans for the next financial year, you would typically target a revenue and based on that you would set your expenses. Setting a budget will ensure that your expenses do not get out of hand at any point based on your plans.
|
||||||
|
|
||||||
|
You can define it in the Cost Center. If you have seasonal sales you can also define a budget distribution that the budget will follow.
|
||||||
|

|
||||||
|
#### Budget Actions
|
||||||
|
|
||||||
|
ERPNext allows you to either:
|
||||||
|
|
||||||
|
- Stop.
|
||||||
|
- Warn or,
|
||||||
|
- Ignore
|
||||||
|
|
||||||
|
if you exceed budgets.
|
||||||
|
|
||||||
|
These can be defined from the Company record.
|
||||||
|
|
||||||
|
Even if you choose to “ignore” budget overruns, you will get a wealth of information from the “Budget vs Actual” variance report.
|
||||||
|
|
||||||
|
> Note: When you set a budget, it has to be set per Account under the Cost Center. For example if you have a Cost Center “Online Sales”, you can restrict “Advertising Budget” by creating a row with that Account and defining the amount.
|
@ -6,6 +6,7 @@
|
|||||||
"docs.user.setup.strategy",
|
"docs.user.setup.strategy",
|
||||||
"docs.user.setup.first",
|
"docs.user.setup.first",
|
||||||
"docs.user.setup.accounting",
|
"docs.user.setup.accounting",
|
||||||
|
"docs.user.setup.cost_centers",
|
||||||
"docs.user.setup.item",
|
"docs.user.setup.item",
|
||||||
"docs.user.setup.customer",
|
"docs.user.setup.customer",
|
||||||
"docs.user.setup.supplier",
|
"docs.user.setup.supplier",
|
||||||
|
@ -59,19 +59,6 @@ cur_frm.cscript.make_address = function() {
|
|||||||
parent: cur_frm.fields_dict['address_html'].wrapper,
|
parent: cur_frm.fields_dict['address_html'].wrapper,
|
||||||
page_length: 5,
|
page_length: 5,
|
||||||
new_doctype: "Address",
|
new_doctype: "Address",
|
||||||
custom_new_doc: function(doctype) {
|
|
||||||
var address = wn.model.make_new_doc_and_get_name('Address');
|
|
||||||
address = locals['Address'][address];
|
|
||||||
address.customer = cur_frm.doc.name;
|
|
||||||
address.customer_name = cur_frm.doc.customer_name;
|
|
||||||
address.address_title = cur_frm.doc.customer_name;
|
|
||||||
|
|
||||||
if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) {
|
|
||||||
address.address_type = "Office";
|
|
||||||
}
|
|
||||||
|
|
||||||
wn.set_route("Form", "Address", address.name);
|
|
||||||
},
|
|
||||||
get_query: function() {
|
get_query: function() {
|
||||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||||
},
|
},
|
||||||
@ -89,16 +76,6 @@ cur_frm.cscript.make_contact = function() {
|
|||||||
cur_frm.contact_list = new wn.ui.Listing({
|
cur_frm.contact_list = new wn.ui.Listing({
|
||||||
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
||||||
page_length: 5,
|
page_length: 5,
|
||||||
custom_new_doc: function(doctype) {
|
|
||||||
var contact = wn.model.make_new_doc_and_get_name('Contact');
|
|
||||||
contact = locals['Contact'][contact];
|
|
||||||
contact.customer = cur_frm.doc.name;
|
|
||||||
contact.customer_name = cur_frm.doc.customer_name;
|
|
||||||
if(cur_frm.doc.customer_type == 'Individual') {
|
|
||||||
contact.first_name = cur_frm.doc.customer_name;
|
|
||||||
}
|
|
||||||
wn.set_route("Form", "Contact", contact.name);
|
|
||||||
},
|
|
||||||
new_doctype: "Contact",
|
new_doctype: "Contact",
|
||||||
get_query: function() {
|
get_query: function() {
|
||||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||||
|
@ -65,16 +65,6 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
|||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
@ -122,16 +122,6 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
|||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT name, address_line1, city FROM tabAddress \
|
return 'SELECT name, address_line1, city FROM tabAddress \
|
||||||
WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
|
WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
|
||||||
|
@ -548,16 +548,6 @@ cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field('batch_no').get_query
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT name, address_line1, city FROM tabAddress \
|
return 'SELECT name, address_line1, city FROM tabAddress \
|
||||||
WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
|
WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
|
||||||
|
@ -94,18 +94,6 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
|||||||
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
|
||||||
locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Get Purchase Order Button
|
// Get Purchase Order Button
|
||||||
// -----------------
|
// -----------------
|
||||||
cur_frm.cscript.pull_purchase_order_details = function(doc, dt, dn) {
|
cur_frm.cscript.pull_purchase_order_details = function(doc, dt, dn) {
|
||||||
|
@ -46,16 +46,6 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
|||||||
JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +
|
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +
|
||||||
'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
|
@ -39,16 +39,6 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
|||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
@ -45,16 +45,6 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
|||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer_address.on_new = function(dn) {
|
|
||||||
locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
|
||||||
locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
|
|
||||||
locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,4 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
wn.require('app/controllers/js/contact_address_common.js');
|
||||||
cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
|
||||||
cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
|
||||||
|
|
||||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
|
||||||
cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query;
|
|
||||||
}
|
|
@ -14,13 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
wn.require('app/controllers/js/contact_address_common.js');
|
||||||
cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
|
||||||
cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
|
||||||
|
|
||||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
|
||||||
cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc) {
|
cur_frm.cscript.refresh = function(doc) {
|
||||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||||
@ -28,7 +22,7 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
recipients: doc.email_id
|
recipients: doc.email_id
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.hide_dialog = function() {
|
cur_frm.cscript.hide_dialog = function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user