[cleanup] move contact, address to frappe 💥
This commit is contained in:
parent
448acf6f46
commit
b92087cb2d
@ -8,7 +8,7 @@ frappe.provide("erpnext.accounts");
|
||||
erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
onload: function() {
|
||||
this._super();
|
||||
|
||||
|
||||
if(!this.frm.doc.__islocal) {
|
||||
// show credit_to in print format
|
||||
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
|
||||
@ -32,7 +32,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
if(doc.update_stock==1 && doc.docstatus==1) {
|
||||
this.show_stock_ledger();
|
||||
}
|
||||
|
||||
|
||||
if(!doc.is_return && doc.docstatus==1) {
|
||||
if(doc.outstanding_amount != 0) {
|
||||
this.frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make"));
|
||||
@ -218,18 +218,6 @@ cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query",
|
||||
|
@ -8,8 +8,8 @@ import datetime
|
||||
from frappe import _, msgprint, scrub
|
||||
from frappe.defaults import get_user_permissions
|
||||
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, add_years
|
||||
from erpnext.utilities.doctype.address.address import get_address_display
|
||||
from erpnext.utilities.doctype.contact.contact import get_contact_details
|
||||
from frappe.geo.doctype.address.address import get_address_display, get_default_address
|
||||
from frappe.email.doctype.contact.contact import get_contact_details, get_default_contact
|
||||
from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency
|
||||
|
||||
class DuplicatePartyAccountError(frappe.ValidationError): pass
|
||||
@ -60,21 +60,18 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
|
||||
def set_address_details(out, party, party_type):
|
||||
billing_address_field = "customer_address" if party_type == "Lead" \
|
||||
else party_type.lower() + "_address"
|
||||
out[billing_address_field] = frappe.db.get_value("Address",
|
||||
{party_type.lower(): party.name, "is_primary_address":1}, "name")
|
||||
out[billing_address_field] = get_default_address(party_type, party.name)
|
||||
|
||||
# address display
|
||||
out.address_display = get_address_display(out[billing_address_field])
|
||||
|
||||
# shipping address
|
||||
if party_type in ["Customer", "Lead"]:
|
||||
out.shipping_address_name = frappe.db.get_value("Address",
|
||||
{party_type.lower(): party.name, "is_shipping_address":1}, "name")
|
||||
out.shipping_address_name = get_default_address(party_type, party.name, 'is_shipping_address')
|
||||
out.shipping_address = get_address_display(out["shipping_address_name"])
|
||||
|
||||
def set_contact_details(out, party, party_type):
|
||||
out.contact_person = frappe.db.get_value("Contact",
|
||||
{party_type.lower(): party.name, "is_primary_contact":1}, "name")
|
||||
out.contact_person = get_default_contact(party_type, party.name)
|
||||
|
||||
if not out.contact_person:
|
||||
out.update({
|
||||
@ -184,7 +181,7 @@ def get_party_account(party_type, party, company):
|
||||
default_account_name = "default_receivable_account" \
|
||||
if party_type=="Customer" else "default_payable_account"
|
||||
account = frappe.db.get_value("Company", company, default_account_name)
|
||||
|
||||
|
||||
existing_gle_currency = get_party_gle_currency(party_type, party, company)
|
||||
if existing_gle_currency:
|
||||
if account:
|
||||
@ -211,7 +208,7 @@ def get_party_gle_currency(party_type, party, company):
|
||||
|
||||
return frappe.local_cache("party_gle_currency", (party_type, party, company), generator,
|
||||
regenerate_if_none=True)
|
||||
|
||||
|
||||
def get_party_gle_account(party_type, party, company):
|
||||
def generator():
|
||||
existing_gle_account = frappe.db.sql("""select account from `tabGL Entry`
|
||||
|
@ -50,13 +50,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
});
|
||||
}
|
||||
|
||||
$.each([["supplier", "supplier"],
|
||||
["contact_person", "supplier_filter"],
|
||||
["supplier_address", "supplier_filter"]],
|
||||
function(i, opts) {
|
||||
if(me.frm.fields_dict[opts[0]])
|
||||
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||
});
|
||||
me.frm.set_query('supplier', erpnext.queries.supplier);
|
||||
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||
me.frm.set_query('supplier_address', erpnext.queries.address_query);
|
||||
|
||||
if(this.frm.fields_dict.supplier) {
|
||||
this.frm.set_query("supplier", function() {
|
||||
@ -79,6 +75,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
},
|
||||
|
||||
refresh: function(doc) {
|
||||
frappe.contact_link = {doc: this.frm.doc, fieldname: 'supplier', doctype: 'Supplier'};
|
||||
|
||||
this.frm.toggle_display("supplier_name",
|
||||
(this.frm.doc.supplier_name && this.frm.doc.supplier_name!==this.frm.doc.supplier));
|
||||
|
||||
|
@ -226,18 +226,6 @@ cur_frm.cscript.update_status= function(label, status){
|
||||
})
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters: {'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters: {'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['items'].grid.get_field('project').get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters:[
|
||||
|
@ -16,6 +16,8 @@ frappe.ui.form.on("Supplier", {
|
||||
});
|
||||
},
|
||||
refresh: function(frm) {
|
||||
frappe.contact_link = {doc: frm.doc, fieldname: 'name', doctype: 'Supplier'}
|
||||
|
||||
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
|
||||
frm.toggle_display("naming_series", false);
|
||||
} else {
|
||||
|
@ -59,15 +59,3 @@ cur_frm.fields_dict['items'].grid.get_field('project').get_query =
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
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.queries.customer;
|
||||
cur_frm.fields_dict.supplier.get_query = erpnext.queries.supplier;
|
||||
|
||||
if(cur_frm.fields_dict.lead) {
|
||||
cur_frm.fields_dict.lead.get_query = erpnext.queries.lead;
|
||||
cur_frm.add_fetch('lead', 'lead_name', 'lead_name');
|
||||
}
|
||||
|
||||
if(doc.__islocal) {
|
||||
var last_route = frappe.route_history.slice(-2, -1)[0];
|
||||
if(last_route && last_route[0]==="Form") {
|
||||
var doctype = last_route[1],
|
||||
docname = last_route.slice(2).join("/");
|
||||
|
||||
if(["Customer", "Quotation", "Sales Order", "Sales Invoice", "Delivery Note",
|
||||
"Installation Note", "Opportunity", "Warranty Claim", "Maintenance Visit",
|
||||
"Maintenance Schedule"]
|
||||
.indexOf(doctype)!==-1) {
|
||||
var refdoc = frappe.get_doc(doctype, docname);
|
||||
if((refdoc.doctype == "Quotation" && refdoc.quotation_to=="Customer") ||
|
||||
(refdoc.doctype == "Opportunity" && refdoc.enquiry_from=="Customer") ||
|
||||
!in_list(["Opportunity", "Quotation"], doctype)) {
|
||||
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
|
||||
cur_frm.set_value("customer_name", refdoc.customer_name);
|
||||
if(cur_frm.doc.doctype==="Address")
|
||||
cur_frm.set_value("address_title", cur_frm.doc.customer_name);
|
||||
}
|
||||
}
|
||||
else if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
|
||||
.indexOf(doctype)!==-1) {
|
||||
var refdoc = frappe.get_doc(doctype, docname);
|
||||
cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
|
||||
cur_frm.set_value("supplier_name", refdoc.supplier_name);
|
||||
if(cur_frm.doc.doctype==="Address")
|
||||
cur_frm.set_value("address_title", cur_frm.doc.supplier_name);
|
||||
}
|
||||
else if(["Lead", "Opportunity", "Quotation"]
|
||||
.indexOf(doctype)!==-1) {
|
||||
var refdoc = frappe.get_doc(doctype, docname);
|
||||
|
||||
if((refdoc.doctype == "Quotation" && refdoc.quotation_to=="Lead") ||
|
||||
(refdoc.doctype == "Opportunity" && refdoc.enquiry_from=="Lead") || (doctype=="Lead")) {
|
||||
cur_frm.set_value("lead", refdoc.lead || refdoc.name);
|
||||
cur_frm.set_value("lead_name", refdoc.customer_name || refdoc.company_name || refdoc.lead_name);
|
||||
if(cur_frm.doc.doctype==="Address")
|
||||
cur_frm.set_value("address_title", cur_frm.doc.lead_name);
|
||||
}
|
||||
}
|
||||
else if(doctype == "Sales Partner") {
|
||||
cur_frm.set_value("sales_partner", docname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,32 +3,9 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.desk.reportview import get_match_cond
|
||||
from frappe.model.db_query import DatabaseQuery
|
||||
from frappe.desk.reportview import get_match_cond, get_filters_cond
|
||||
from frappe.utils import nowdate
|
||||
|
||||
def get_filters_cond(doctype, filters, conditions):
|
||||
if filters:
|
||||
flt = filters
|
||||
if isinstance(filters, dict):
|
||||
filters = filters.items()
|
||||
flt = []
|
||||
for f in filters:
|
||||
if isinstance(f[1], basestring) and f[1][0] == '!':
|
||||
flt.append([doctype, f[0], '!=', f[1][1:]])
|
||||
else:
|
||||
value = frappe.db.escape(f[1]) if isinstance(f[1], basestring) else f[1]
|
||||
flt.append([doctype, f[0], '=', value])
|
||||
|
||||
query = DatabaseQuery(doctype)
|
||||
query.filters = flt
|
||||
query.conditions = conditions
|
||||
query.build_filter_conditions(flt, conditions)
|
||||
|
||||
cond = ' and ' + ' and '.join(query.conditions)
|
||||
else:
|
||||
cond = ''
|
||||
return cond
|
||||
|
||||
# searches for active employees
|
||||
def employee_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
@ -88,7 +65,7 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
fields = ["name", "customer_group", "territory"]
|
||||
else:
|
||||
fields = ["name", "customer_name", "customer_group", "territory"]
|
||||
|
||||
|
||||
meta = frappe.get_meta("Customer")
|
||||
fields = fields + [f for f in meta.get_search_fields() if not f in fields]
|
||||
|
||||
|
@ -6,9 +6,14 @@ frappe.provide("erpnext.crm");
|
||||
cur_frm.email_field = "contact_email";
|
||||
frappe.ui.form.on("Opportunity", {
|
||||
customer: function(frm) {
|
||||
frm.trigger('set_contact_link');
|
||||
erpnext.utils.get_party_details(frm);
|
||||
},
|
||||
|
||||
lead: function(frm) {
|
||||
frm.trigger('set_contact_link');
|
||||
},
|
||||
|
||||
customer_address: function(frm, cdt, cdn) {
|
||||
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
|
||||
},
|
||||
@ -23,6 +28,8 @@ frappe.ui.form.on("Opportunity", {
|
||||
refresh: function(frm) {
|
||||
var doc = frm.doc;
|
||||
frm.events.enquiry_from(frm);
|
||||
frm.trigger('set_contact_link');
|
||||
|
||||
if(doc.status!=="Lost") {
|
||||
if(doc.with_items){
|
||||
frm.add_custom_button(__('Supplier Quotation'),
|
||||
@ -35,7 +42,7 @@ frappe.ui.form.on("Opportunity", {
|
||||
cur_frm.cscript.create_quotation, __("Make"));
|
||||
|
||||
frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||
|
||||
|
||||
if(doc.status!=="Quotation") {
|
||||
frm.add_custom_button(__('Lost'),
|
||||
cur_frm.cscript['Declare Opportunity Lost']);
|
||||
@ -43,6 +50,14 @@ frappe.ui.form.on("Opportunity", {
|
||||
}
|
||||
},
|
||||
|
||||
set_contact_link: function(frm) {
|
||||
if(frm.doc.customer) {
|
||||
frappe.contact_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'}
|
||||
} else if(frm.doc.lead) {
|
||||
frappe.contact_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'}
|
||||
}
|
||||
}
|
||||
|
||||
make_supplier_quotation: function(frm) {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.crm.doctype.opportunity.opportunity.make_supplier_quotation",
|
||||
@ -62,7 +77,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
||||
if(!this.frm.doc.status)
|
||||
set_multiple(this.frm.doc.doctype, this.frm.doc.name, { status:'Open' });
|
||||
if(!this.frm.doc.company && frappe.defaults.get_user_default("Company"))
|
||||
set_multiple(this.frm.doc.doctype, this.frm.doc.name,
|
||||
set_multiple(this.frm.doc.doctype, this.frm.doc.name,
|
||||
{ company:frappe.defaults.get_user_default("Company") });
|
||||
|
||||
this.setup_queries();
|
||||
@ -75,10 +90,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
||||
this.frm.set_query("contact_by", erpnext.queries.user);
|
||||
}
|
||||
|
||||
this.frm.set_query("customer_address", function() {
|
||||
if(me.frm.doc.lead) return {filters: { lead: me.frm.doc.lead } };
|
||||
else if(me.frm.doc.customer) return {filters: { customer: me.frm.doc.customer } };
|
||||
});
|
||||
me.frm.set_query('customer_address', erpnext.queries.address_query);
|
||||
|
||||
this.frm.set_query("item_code", "items", function() {
|
||||
return {
|
||||
|
@ -127,7 +127,6 @@ has_website_permission = {
|
||||
"Supplier Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||
"Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission",
|
||||
"Issue": "erpnext.support.doctype.issue.issue.has_website_permission",
|
||||
"Address": "erpnext.utilities.doctype.address.address.has_website_permission",
|
||||
"Discussion": "erpnext.schools.web_form.discussion.discussion.has_website_permission"
|
||||
}
|
||||
|
||||
@ -157,17 +156,11 @@ doc_events = {
|
||||
"User": {
|
||||
"validate": "erpnext.hr.doctype.employee.employee.validate_employee_role",
|
||||
"on_update": "erpnext.hr.doctype.employee.employee.update_user_permissions",
|
||||
"on_update": "erpnext.utilities.doctype.contact.contact.update_contact"
|
||||
"on_update": "frappe.email.doctype.contact.contact.update_contact"
|
||||
},
|
||||
("Sales Taxes and Charges Template", 'Price List'): {
|
||||
"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
|
||||
},
|
||||
"Address": {
|
||||
"validate": "erpnext.shopping_cart.cart.set_customer_in_address"
|
||||
},
|
||||
"Communication":{
|
||||
"after_insert":"erpnext.utilities.doctype.contact.match_email_to_contact"
|
||||
},
|
||||
|
||||
# bubble transaction notification on master
|
||||
('Opportunity', 'Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice',
|
||||
|
@ -3,18 +3,28 @@
|
||||
|
||||
frappe.provide("erpnext.maintenance");
|
||||
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "customer_address", function(){
|
||||
erpnext.utils.get_address_display(cur_frm, 'customer_address', 'address_display');
|
||||
});
|
||||
frappe.ui.form.on_change("Maintenance Schedule", "contact_person", function(){
|
||||
erpnext.utils.get_contact_details(cur_frm);
|
||||
});
|
||||
frappe.ui.form.on('Maintenance Schedule', {
|
||||
setup: function(frm) {
|
||||
frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||
frm.set_query('customer_address', erpnext.queries.address_query);
|
||||
},
|
||||
customer: function(frm) {
|
||||
erpnext.utils.get_party_details(frm)
|
||||
},
|
||||
customer_address: function(frm) {
|
||||
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display');
|
||||
},
|
||||
contact_person: function(frm) {
|
||||
erpnext.utils.get_contact_details(frm);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// TODO commonify this code
|
||||
erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
|
||||
refresh: function() {
|
||||
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
|
||||
|
||||
var me = this;
|
||||
|
||||
if (this.frm.doc.docstatus === 0) {
|
||||
@ -94,18 +104,6 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters:{ 'customer': doc.customer }
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters:{ 'customer': doc.customer }
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
||||
if (!doc.__islocal) {
|
||||
return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc},
|
||||
|
@ -2,20 +2,31 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.provide("erpnext.maintenance");
|
||||
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||
|
||||
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer_address", function(frm){
|
||||
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display')
|
||||
});
|
||||
frappe.ui.form.on_change("Maintenance Visit", "contact_person", function(frm){
|
||||
erpnext.utils.get_contact_details(frm)
|
||||
});
|
||||
frappe.ui.form.on('Maintenance Visit', {
|
||||
setup: function(frm) {
|
||||
frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||
frm.set_query('customer_address', erpnext.queries.address_query);
|
||||
},
|
||||
customer: function(frm) {
|
||||
erpnext.utils.get_party_details(frm)
|
||||
},
|
||||
customer_address: function(frm) {
|
||||
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display');
|
||||
},
|
||||
contact_person: function(frm) {
|
||||
erpnext.utils.get_contact_details(frm);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// TODO commonify this code
|
||||
erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
|
||||
refresh: function() {
|
||||
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
|
||||
|
||||
if (this.frm.doc.docstatus===0) {
|
||||
cur_frm.add_custom_button(__('Maintenance Schedule'),
|
||||
function() {
|
||||
@ -69,18 +80,6 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
cur_frm.add_fetch('item_code', 'description', 'description');
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'customer': doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'customer': doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return {query: "erpnext.controllers.queries.customer_query" }
|
||||
}
|
||||
|
24
erpnext/patches/v7_2/contact_address_links.py
Normal file
24
erpnext/patches/v7_2/contact_address_links.py
Normal file
@ -0,0 +1,24 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doctype('Contact')
|
||||
frappe.reload_doctype('Address')
|
||||
map_fields = (
|
||||
('Customer', 'customer'),
|
||||
('Supplier', 'supplier'),
|
||||
('Load', 'lead'),
|
||||
('Sales Partner', 'sales_partner')
|
||||
)
|
||||
for doctype in ('Contact', 'Address'):
|
||||
if frappe.db.has_column(doctype, 'customer'):
|
||||
for doc in frappe.get_all(doctype, fields='*'):
|
||||
doc.doctype = doctype
|
||||
doc = frappe.get_doc(doc)
|
||||
dirty = False
|
||||
for field in map_fields:
|
||||
if doc.get(field[1]):
|
||||
doc.append('links', dict(link_doctype=field[0], link_name=doc.get(field[1])))
|
||||
dirty = True
|
||||
|
||||
if dirty:
|
||||
doc.save()
|
@ -2,15 +2,14 @@ import frappe
|
||||
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
|
||||
|
||||
def execute():
|
||||
ss_columns = frappe.db.get_table_columns("Salary Slip")
|
||||
if "fiscal_year" not in ss_columns or "month" not in ss_columns:
|
||||
frappe.reload_doctype('Salary Slip')
|
||||
if not frappe.db.has_column('Salary Slip', 'fiscal_year'):
|
||||
return
|
||||
|
||||
salary_slips = frappe.db.sql("""select fiscal_year, month, name from `tabSalary Slip`
|
||||
where (month is not null and month != '')
|
||||
and (fiscal_year is not null and fiscal_year != '') and
|
||||
(start_date is null or start_date = '') and
|
||||
(end_date is null or end_date = '') and docstatus != 2""", as_dict=1)
|
||||
|
||||
salary_slips = frappe.db.sql("""select month, name from `tabSalary Slip`
|
||||
where (month is not null and month != '') and
|
||||
(start_date is null or start_date = '') and
|
||||
(end_date is null or end_date = '') and docstatus != 2""", as_dict=True)
|
||||
|
||||
for salary_slip in salary_slips:
|
||||
get_start_end_date = get_month_details(salary_slip.fiscal_year, salary_slip.month)
|
||||
|
@ -36,17 +36,41 @@ $.extend(erpnext.queries, {
|
||||
|
||||
customer_filter: function(doc) {
|
||||
if(!doc.customer) {
|
||||
frappe.throw(__("Please specify a") + " " +
|
||||
__(frappe.meta.get_label(doc.doctype, "customer", doc.name)));
|
||||
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype, "customer", doc.name))));
|
||||
}
|
||||
|
||||
return { filters: { customer: doc.customer } };
|
||||
},
|
||||
|
||||
contact_query: function(doc) {
|
||||
if(frappe.contact_link) {
|
||||
if(!doc[frappe.contact_link.fieldname]) {
|
||||
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype,
|
||||
frappe.contact_link.fieldname, doc.name))));
|
||||
}
|
||||
|
||||
return {
|
||||
query: 'frappe.email.doctype.contact.contact.contact_query',
|
||||
filters: { link_doctype: frappe.contact_link.doctype, link_name: doc[frappe.contact_link.fieldname] } };
|
||||
}
|
||||
},
|
||||
|
||||
address_query: function(doc) {
|
||||
if(frappe.contact_link) {
|
||||
if(!doc[frappe.contact_link.fieldname]) {
|
||||
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype,
|
||||
frappe.contact_link.fieldname, doc.name))));
|
||||
}
|
||||
|
||||
return {
|
||||
query: 'frappe.email.doctype.address.address_query',
|
||||
filters: { link_doctype: frappe.contact_link.doctype, link_name: doc[frappe.contact_link.fieldname] } };
|
||||
}
|
||||
},
|
||||
|
||||
supplier_filter: function(doc) {
|
||||
if(!doc.supplier) {
|
||||
frappe.throw(__("Please specify a") + " " +
|
||||
__(frappe.meta.get_label(doc.doctype, "supplier", doc.name)));
|
||||
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype, "supplier", doc.name))));
|
||||
}
|
||||
|
||||
return { filters: { supplier: doc.supplier } };
|
||||
@ -74,7 +98,7 @@ $.extend(erpnext.queries, {
|
||||
filters: [
|
||||
["Warehouse", "company", "in", ["", cstr(doc.company)]],
|
||||
["Warehouse", "is_group", "=",0]
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field,
|
||||
if(!display_field) display_field = "address_display";
|
||||
if(frm.doc[address_field]) {
|
||||
frappe.call({
|
||||
method: "erpnext.utilities.doctype.address.address.get_address_display",
|
||||
method: "frappe.geo.doctype.address.address.get_address_display",
|
||||
args: {"address_dict": frm.doc[address_field] },
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
@ -151,7 +151,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) {
|
||||
|
||||
erpnext.utils.get_shipping_address = function(frm, callback){
|
||||
frappe.call({
|
||||
method: "erpnext.utilities.doctype.address.address.get_shipping_address",
|
||||
method: "frappe.geo.doctype.address.address.get_shipping_address",
|
||||
args: {company: frm.doc.company},
|
||||
callback: function(r){
|
||||
if(r.message){
|
||||
|
@ -32,6 +32,8 @@ frappe.ui.form.on("Customer", {
|
||||
erpnext.toggle_naming_series();
|
||||
}
|
||||
|
||||
frappe.contact_link = {doc: frm.doc, fieldname: 'name', doctype: 'Customer'}
|
||||
|
||||
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
||||
|
||||
if(!frm.doc.__islocal) {
|
||||
|
@ -32,11 +32,7 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
|
||||
}
|
||||
});
|
||||
|
||||
this.frm.set_query("contact_person", function() {
|
||||
return {
|
||||
filters: {'customer': me.frm.doc.customer }
|
||||
}
|
||||
});
|
||||
this.frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||
|
||||
this.frm.set_query("customer", function() {
|
||||
return {
|
||||
|
@ -16,6 +16,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
},
|
||||
refresh: function(doc, dt, dn) {
|
||||
this._super(doc, dt, dn);
|
||||
|
||||
if(doc.docstatus == 1 && doc.status!=='Lost') {
|
||||
cur_frm.add_custom_button(__('Make Sales Order'),
|
||||
cur_frm.cscript['Make Sales Order']);
|
||||
|
@ -203,13 +203,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
// for backward compatibility: combine new and previous states
|
||||
$.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.new_contact = function(){
|
||||
tn = frappe.model.make_new_doc_and_get_name('Contact');
|
||||
locals['Contact'][tn].is_customer = 1;
|
||||
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
||||
frappe.set_route('Form', 'Contact', tn);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['project'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.get_project_name",
|
||||
|
@ -26,16 +26,17 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
|
||||
this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
|
||||
|
||||
$.each([["customer_address", "customer_filter"],
|
||||
["shipping_address_name", "customer_filter"],
|
||||
["contact_person", "customer_filter"],
|
||||
["customer", "customer"],
|
||||
$.each([["customer", "customer"],
|
||||
["lead", "lead"]],
|
||||
function(i, opts) {
|
||||
if(me.frm.fields_dict[opts[0]])
|
||||
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
|
||||
});
|
||||
|
||||
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||
me.frm.set_query('customer_address', erpnext.queries.address_query);
|
||||
me.frm.set_query('shipping_address_name', erpnext.queries.address_query);
|
||||
|
||||
if(this.frm.fields_dict.taxes_and_charges) {
|
||||
this.frm.set_query("taxes_and_charges", function() {
|
||||
return {
|
||||
@ -104,6 +105,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
|
||||
refresh: function() {
|
||||
this._super();
|
||||
|
||||
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
|
||||
|
||||
this.frm.toggle_display("customer_name",
|
||||
(this.frm.doc.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
|
||||
if(this.frm.fields_dict.packed_items) {
|
||||
|
@ -1,14 +1,17 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,dt,dn){
|
||||
frappe.ui.form.on('Sales Partner', {
|
||||
refresh: function(frm) {
|
||||
frappe.contact_link = {doc: frm.doc, fieldname: 'name', doctype: 'Sales Person'}
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['address_html', 'contact_html']);
|
||||
erpnext.utils.clear_address_and_contact(cur_frm);
|
||||
if(doc.__islocal){
|
||||
hide_field(['address_html', 'contact_html']);
|
||||
erpnext.utils.clear_address_and_contact(frm);
|
||||
}
|
||||
else{
|
||||
unhide_field(['address_html', 'contact_html']);
|
||||
erpnext.utils.render_address_and_contact(frm);
|
||||
}
|
||||
}
|
||||
else{
|
||||
unhide_field(['address_html', 'contact_html']);
|
||||
erpnext.utils.render_address_and_contact(cur_frm);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ import frappe
|
||||
from frappe import throw, _
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint, flt, get_fullname, cstr
|
||||
from erpnext.utilities.doctype.address.address import get_address_display
|
||||
from frappe.geo.doctype.address.address import get_address_display
|
||||
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import get_shopping_cart_settings
|
||||
from frappe.utils.nestedset import get_root_of
|
||||
from erpnext.accounts.utils import get_account_name
|
||||
@ -383,17 +383,6 @@ def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_
|
||||
|
||||
return address_docs
|
||||
|
||||
def set_customer_in_address(doc, method=None):
|
||||
if doc.flags.linked:
|
||||
return
|
||||
|
||||
doc.check_if_linked()
|
||||
|
||||
if not doc.flags.linked and (frappe.db.get_value("User", frappe.session.user, "user_type") == "Website User"):
|
||||
# creates a customer if one does not exist
|
||||
get_party()
|
||||
doc.link_address()
|
||||
|
||||
@frappe.whitelist()
|
||||
def apply_shipping_rule(shipping_rule):
|
||||
quotation = _get_cart_quotation()
|
||||
|
@ -137,13 +137,6 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
|
||||
// for backward compatibility: combine new and previous states
|
||||
$.extend(cur_frm.cscript, new erpnext.stock.DeliveryNoteController({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.new_contact = function(){
|
||||
tn = frappe.model.make_new_doc_and_get_name('Contact');
|
||||
locals['Contact'][tn].is_customer = 1;
|
||||
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
||||
frappe.set_route('Form', 'Contact', tn);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.update_status = function(status) {
|
||||
frappe.ui.form.is_saving = true;
|
||||
|
@ -26,7 +26,7 @@ frappe.ui.form.on("Purchase Receipt", {
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -122,26 +122,6 @@ cur_frm.cscript.update_status = function(status) {
|
||||
})
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters: { 'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters: { 'supplier': doc.supplier }
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.new_contact = function() {
|
||||
tn = frappe.model.make_new_doc_and_get_name('Contact');
|
||||
locals['Contact'][tn].is_supplier = 1;
|
||||
if(doc.supplier)
|
||||
locals['Contact'][tn].supplier = doc.supplier;
|
||||
frappe.set_route('Form', 'Contact', tn);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['items'].grid.get_field('project').get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters: [
|
||||
|
@ -4,6 +4,10 @@
|
||||
frappe.provide("erpnext.support");
|
||||
|
||||
frappe.ui.form.on("Warranty Claim", {
|
||||
setup: function(frm) {
|
||||
frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||
frm.set_query('customer_address', erpnext.queries.address_query);
|
||||
},
|
||||
customer: function(frm) {
|
||||
erpnext.utils.get_party_details(frm);
|
||||
},
|
||||
@ -17,6 +21,8 @@ frappe.ui.form.on("Warranty Claim", {
|
||||
|
||||
erpnext.support.WarrantyClaim = frappe.ui.form.Controller.extend({
|
||||
refresh: function() {
|
||||
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
|
||||
|
||||
if(!cur_frm.doc.__islocal &&
|
||||
(cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) {
|
||||
cur_frm.add_custom_button(__('Maintenance Visit'),
|
||||
@ -40,18 +46,6 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
set_multiple(cdt,cdn,{status:'Open'});
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{ 'customer': doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{ 'customer': doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) {
|
||||
var cond = [];
|
||||
var filter = [
|
||||
|
@ -6,17 +6,33 @@ import frappe
|
||||
|
||||
def load_address_and_contact(doc, key):
|
||||
"""Loads address list and contact list in `__onload`"""
|
||||
from erpnext.utilities.doctype.address.address import get_address_display
|
||||
from frappe.geo.doctype.address.address import get_address_display
|
||||
|
||||
doc.get("__onload")["addr_list"] = [a.update({"display": get_address_display(a)}) \
|
||||
for a in frappe.get_all("Address",
|
||||
fields="*", filters={key: doc.name},
|
||||
order_by="is_primary_address desc, modified desc")]
|
||||
address_list = [frappe.get_value('Address', a.parent, '*')
|
||||
for a in frappe.get_all('Dynamic Link', fields='parent',
|
||||
filters=dict(parenttype='Address', link_doctype=doc.doctype, link_name=doc.name))]
|
||||
|
||||
address_list = [a.update({"display": get_address_display(a)})
|
||||
for a in address_list]
|
||||
|
||||
address_list = sorted(address_list,
|
||||
lambda a, b:
|
||||
(int(a.is_primary_address - b.is_primary_address)) or
|
||||
(1 if a.modified - b.modified else 0))
|
||||
|
||||
doc.set_onload('addr_list', address_list)
|
||||
|
||||
if doc.doctype != "Lead":
|
||||
doc.get("__onload")["contact_list"] = frappe.get_all("Contact",
|
||||
fields="*", filters={key: doc.name},
|
||||
order_by="is_primary_contact desc, modified desc")
|
||||
contact_list = [frappe.get_value('Contact', a.parent, '*')
|
||||
for a in frappe.get_all('Dynamic Link', fields='parent',
|
||||
filters=dict(parenttype='Contact', link_doctype=doc.doctype, link_name=doc.name))]
|
||||
|
||||
contact_list = sorted(contact_list,
|
||||
lambda a, b:
|
||||
(int(a.is_primary_contact - b.is_primary_contact)) or
|
||||
(1 if a.modified - b.modified else 0))
|
||||
|
||||
doc.set_onload('contact_list', contact_list)
|
||||
|
||||
def has_permission(doc, ptype, user):
|
||||
links = get_permitted_and_not_permitted_links(doc.doctype)
|
||||
@ -50,15 +66,15 @@ def get_permission_query_conditions(doctype):
|
||||
if not links.get("not_permitted_links"):
|
||||
# when everything is permitted, don't add additional condition
|
||||
return ""
|
||||
|
||||
|
||||
elif not links.get("permitted_links"):
|
||||
conditions = []
|
||||
|
||||
|
||||
# when everything is not permitted
|
||||
for df in links.get("not_permitted_links"):
|
||||
# like ifnull(customer, '')='' and ifnull(supplier, '')=''
|
||||
conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')=''".format(doctype=doctype, fieldname=df.fieldname))
|
||||
|
||||
|
||||
return "( " + " and ".join(conditions) + " )"
|
||||
|
||||
else:
|
||||
@ -66,7 +82,7 @@ def get_permission_query_conditions(doctype):
|
||||
|
||||
for df in links.get("permitted_links"):
|
||||
# like ifnull(customer, '')!='' or ifnull(supplier, '')!=''
|
||||
conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')!=''".format(doctype=doctype, fieldname=df.fieldname))
|
||||
conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')!=''".format(doctype=doctype, fieldname=df.fieldname))
|
||||
|
||||
return "( " + " or ".join(conditions) + " )"
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
Address belonging to a Customer or Supplier.
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
{% include 'erpnext/controllers/js/contact_address_common.js' %};
|
||||
|
||||
frappe.ui.form.on("Address", "validate", function(frm) {
|
||||
// clear linked customer / supplier / sales partner on saving...
|
||||
$.each(["Customer", "Supplier", "Sales Partner", "Lead"], function(i, doctype) {
|
||||
var name = frm.doc[doctype.toLowerCase().replace(/ /g, "_")];
|
||||
if(name && locals[doctype] && locals[doctype][name])
|
||||
frappe.model.remove_from_locals(doctype, name);
|
||||
});
|
||||
});
|
@ -1,880 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"beta": 0,
|
||||
"creation": "2013-01-10 16:34:32",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "address_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "fa fa-map-marker",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "Name of person or organization that this address belongs to.",
|
||||
"fieldname": "address_title",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Address Title",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "address_type",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Address Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Billing\nShipping\nOffice\nPersonal\nPlant\nPostal\nShop\nSubsidiary\nWarehouse\nOther",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "address_line1",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Address Line 1",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "address_line2",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Address Line 2",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "city",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "City/Town",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "county",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "County",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "state",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "State",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "country",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Country",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Country",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "pincode",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Postal Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "email_id",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Email Address",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "phone",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Phone",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "fax",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Fax",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"description": "",
|
||||
"fieldname": "is_primary_address",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Preferred Billing Address",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"description": "",
|
||||
"fieldname": "is_shipping_address",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Preferred Shipping Address",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "linked_with",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reference",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "fa fa-pushpin",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "is_your_company_address",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Your Company Address",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.is_your_company_address",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.is_your_company_address",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Customer",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.is_your_company_address",
|
||||
"fieldname": "customer_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "organisation",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Organisation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Organisation",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.is_your_company_address",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.is_your_company_address",
|
||||
"fieldname": "supplier_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval: !doc.is_your_company_address",
|
||||
"fieldname": "sales_partner",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Partner",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Partner",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.supplier && !doc.sales_partner && !doc.is_your_company_address",
|
||||
"fieldname": "lead",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Lead",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Lead",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.supplier && !doc.sales_partner && !doc.is_your_company_address",
|
||||
"fieldname": "lead_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Lead Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-map-marker",
|
||||
"idx": 5,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-12-22 13:49:22.968498",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Utilities",
|
||||
"name": "Address",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Purchase User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Maintenance User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": "customer, supplier, sales_partner, country, state",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
@ -1,181 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe import throw, _
|
||||
from frappe.utils import cstr
|
||||
|
||||
from frappe.model.document import Document
|
||||
from jinja2 import TemplateSyntaxError
|
||||
from frappe.utils.user import is_website_user
|
||||
from frappe.model.naming import make_autoname
|
||||
|
||||
class Address(Document):
|
||||
def __setup__(self):
|
||||
self.flags.linked = False
|
||||
|
||||
def autoname(self):
|
||||
if not self.address_title:
|
||||
self.address_title = self.customer \
|
||||
or self.supplier or self.sales_partner or self.lead or self.organisation
|
||||
|
||||
if self.address_title:
|
||||
self.name = (cstr(self.address_title).strip() + "-" + cstr(self.address_type).strip())
|
||||
if frappe.db.exists("Address", self.name):
|
||||
self.name = make_autoname(cstr(self.address_title).strip() + "-" +
|
||||
cstr(self.address_type).strip() + "-.#")
|
||||
else:
|
||||
throw(_("Address Title is mandatory."))
|
||||
|
||||
def validate(self):
|
||||
self.link_fields = ("customer", "supplier", "sales_partner", "lead", "organisation")
|
||||
self.link_address()
|
||||
self.validate_primary_address()
|
||||
self.validate_shipping_address()
|
||||
self.validate_reference()
|
||||
|
||||
def validate_primary_address(self):
|
||||
"""Validate that there can only be one primary address for particular customer, supplier"""
|
||||
if self.is_primary_address == 1:
|
||||
self._unset_other("is_primary_address")
|
||||
|
||||
elif self.is_shipping_address != 1:
|
||||
for fieldname in self.link_fields:
|
||||
if self.get(fieldname):
|
||||
if not frappe.db.sql("""select name from `tabAddress` where is_primary_address=1
|
||||
and `%s`=%s and name!=%s""" % (frappe.db.escape(fieldname), "%s", "%s"),
|
||||
(self.get(fieldname), self.name)):
|
||||
self.is_primary_address = 1
|
||||
break
|
||||
|
||||
def link_address(self):
|
||||
"""Link address based on owner"""
|
||||
if not self.flags.linked:
|
||||
self.check_if_linked()
|
||||
|
||||
if not self.flags.linked and not self.is_your_company_address:
|
||||
contact = frappe.db.get_value("Contact", {"email_id": self.owner},
|
||||
("name", "customer", "supplier"), as_dict = True)
|
||||
if contact:
|
||||
self.customer = contact.customer
|
||||
self.supplier = contact.supplier
|
||||
|
||||
self.lead = frappe.db.get_value("Lead", {"email_id": self.owner})
|
||||
|
||||
def check_if_linked(self):
|
||||
for fieldname in self.link_fields:
|
||||
if self.get(fieldname):
|
||||
self.flags.linked = True
|
||||
break
|
||||
|
||||
def validate_shipping_address(self):
|
||||
"""Validate that there can only be one shipping address for particular customer, supplier"""
|
||||
if self.is_shipping_address == 1:
|
||||
self._unset_other("is_shipping_address")
|
||||
|
||||
def validate_reference(self):
|
||||
if self.is_your_company_address:
|
||||
if not self.company:
|
||||
frappe.throw(_("Company is mandatory, as it is your company address"))
|
||||
if self.customer or self.supplier or self.sales_partner or self.lead:
|
||||
frappe.throw(_("Remove reference of customer, supplier, sales partner and lead, as it is your company address"))
|
||||
|
||||
def _unset_other(self, is_address_type):
|
||||
for fieldname in ["customer", "supplier", "sales_partner", "lead", "organisation"]:
|
||||
if self.get(fieldname):
|
||||
frappe.db.sql("""update `tabAddress` set `%s`=0 where `%s`=%s and name!=%s""" %
|
||||
(is_address_type, fieldname, "%s", "%s"), (self.get(fieldname), self.name))
|
||||
break
|
||||
|
||||
def get_display(self):
|
||||
return get_address_display(self.as_dict())
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_address_display(address_dict):
|
||||
if not address_dict:
|
||||
return
|
||||
|
||||
if not isinstance(address_dict, dict):
|
||||
address_dict = frappe.db.get_value("Address", address_dict, "*", as_dict=True) or {}
|
||||
|
||||
name, template = get_address_templates(address_dict)
|
||||
|
||||
try:
|
||||
return frappe.render_template(template, address_dict)
|
||||
except TemplateSyntaxError:
|
||||
frappe.throw(_("There is an error in your Address Template {0}").format(name))
|
||||
|
||||
|
||||
def get_territory_from_address(address):
|
||||
"""Tries to match city, state and country of address to existing territory"""
|
||||
if not address:
|
||||
return
|
||||
|
||||
if isinstance(address, basestring):
|
||||
address = frappe.get_doc("Address", address)
|
||||
|
||||
territory = None
|
||||
for fieldname in ("city", "state", "country"):
|
||||
territory = frappe.db.get_value("Territory", address.get(fieldname))
|
||||
if territory:
|
||||
break
|
||||
|
||||
return territory
|
||||
|
||||
def get_list_context(context=None):
|
||||
from erpnext.shopping_cart.cart import get_address_docs
|
||||
return {
|
||||
"title": _("Addresses"),
|
||||
"get_list": get_address_list,
|
||||
"row_template": "templates/includes/address_row.html",
|
||||
'no_breadcrumbs': True,
|
||||
}
|
||||
|
||||
def get_address_list(doctype, txt, filters, limit_start, limit_page_length=20):
|
||||
from frappe.www.list import get_list
|
||||
user = frappe.session.user
|
||||
ignore_permissions = False
|
||||
if is_website_user():
|
||||
if not filters: filters = []
|
||||
filters.append(("Address", "owner", "=", user))
|
||||
ignore_permissions = True
|
||||
|
||||
return get_list(doctype, txt, filters, limit_start, limit_page_length, ignore_permissions=ignore_permissions)
|
||||
|
||||
def has_website_permission(doc, ptype, user, verbose=False):
|
||||
"""Returns true if customer or lead matches with user"""
|
||||
customer = frappe.db.get_value("Contact", {"email_id": frappe.session.user}, "customer")
|
||||
if customer:
|
||||
return doc.customer == customer
|
||||
else:
|
||||
lead = frappe.db.get_value("Lead", {"email_id": frappe.session.user})
|
||||
if lead:
|
||||
return doc.lead == lead
|
||||
|
||||
return False
|
||||
|
||||
def get_address_templates(address):
|
||||
result = frappe.db.get_value("Address Template", \
|
||||
{"country": address.get("country")}, ["name", "template"])
|
||||
|
||||
if not result:
|
||||
result = frappe.db.get_value("Address Template", \
|
||||
{"is_default": 1}, ["name", "template"])
|
||||
|
||||
if not result:
|
||||
frappe.throw(_("No default Address Template found. Please create a new one from Setup > Printing and Branding > Address Template."))
|
||||
else:
|
||||
return result
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_shipping_address(company):
|
||||
filters = {"company": company, "is_your_company_address":1}
|
||||
fieldname = ["name", "address_line1", "address_line2", "city", "state", "country"]
|
||||
|
||||
address_as_dict = frappe.db.get_value("Address", filters=filters, fieldname=fieldname, as_dict=True)
|
||||
|
||||
if address_as_dict:
|
||||
name, address_template = get_address_templates(address_as_dict)
|
||||
return address_as_dict.get("name"), frappe.render_template(address_template, address_as_dict)
|
@ -1,21 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
test_records = frappe.get_test_records('Address')
|
||||
|
||||
import unittest
|
||||
import frappe
|
||||
|
||||
from erpnext.utilities.doctype.address.address import get_address_display
|
||||
|
||||
class TestAddress(unittest.TestCase):
|
||||
def test_template_works(self):
|
||||
address = frappe.get_list("Address")[0].name
|
||||
display = get_address_display(frappe.get_doc("Address", address).as_dict())
|
||||
self.assertTrue(display)
|
||||
|
||||
|
||||
test_dependencies = ["Address Template"]
|
@ -1,15 +0,0 @@
|
||||
[
|
||||
{
|
||||
"address_line1": "_Test Address Line 1",
|
||||
"address_title": "_Test Address",
|
||||
"address_type": "Office",
|
||||
"city": "_Test City",
|
||||
"state": "Test State",
|
||||
"country": "India",
|
||||
"customer": "_Test Customer",
|
||||
"customer_name": "_Test Customer",
|
||||
"doctype": "Address",
|
||||
"is_primary_address": 1,
|
||||
"phone": "+91 0000000000"
|
||||
}
|
||||
]
|
@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Address Template', {
|
||||
refresh: function(frm) {
|
||||
if(frm.is_new() && !frm.doc.template) {
|
||||
// set default template via js so that it is translated
|
||||
frappe.call({
|
||||
method: 'erpnext.utilities.doctype.address_template.address_template.get_default_address_template',
|
||||
callback: function(r) {
|
||||
frm.set_value('template', r.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
@ -1,147 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:country",
|
||||
"beta": 0,
|
||||
"creation": "2014-06-05 02:22:36.029850",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 0,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "country",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Country",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Country",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "This format is used if country specific format is not found",
|
||||
"fieldname": "is_default",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Default",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "",
|
||||
"description": "<h4>Default Template</h4>\n<p>Uses <a href=\"http://jinja.pocoo.org/docs/templates/\">Jinja Templating</a> and all the fields of Address (including Custom Fields if any) will be available</p>\n<pre><code>{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif -%}\n{% if pincode %} PIN: {{ pincode }}<br>{% endif -%}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif -%}\n{% if fax %}Fax: {{ fax }}<br>{% endif -%}\n{% if email_id %}Email: {{ email_id }}<br>{% endif -%}\n</code></pre>",
|
||||
"fieldname": "template",
|
||||
"fieldtype": "Code",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Template",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-map-marker",
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-11-07 05:47:11.633848",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Utilities",
|
||||
"name": "Address Template",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 0,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 1,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils.jinja import validate_template
|
||||
from frappe import _
|
||||
|
||||
class AddressTemplate(Document):
|
||||
def validate(self):
|
||||
if not self.template:
|
||||
self.template = get_default_address_template()
|
||||
|
||||
self.defaults = frappe.db.get_values("Address Template", {"is_default":1, "name":("!=", self.name)})
|
||||
if not self.is_default:
|
||||
if not self.defaults:
|
||||
self.is_default = 1
|
||||
frappe.msgprint(_("Setting this Address Template as default as there is no other default"))
|
||||
|
||||
validate_template(self.template)
|
||||
|
||||
def on_update(self):
|
||||
if self.is_default and self.defaults:
|
||||
for d in self.defaults:
|
||||
frappe.db.set_value("Address Template", d[0], "is_default", 0)
|
||||
|
||||
def on_trash(self):
|
||||
if self.is_default:
|
||||
frappe.throw(_("Default Address Template cannot be deleted"))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_default_address_template():
|
||||
'''Get default address template (translated)'''
|
||||
return '''{{ address_line1 }}<br>{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\
|
||||
{{ city }}<br>
|
||||
{% if state %}{{ state }}<br>{% endif -%}
|
||||
{% if pincode %}{{ pincode }}<br>{% endif -%}
|
||||
{{ country }}<br>
|
||||
{% if phone %}'''+_('Phone')+''': {{ phone }}<br>{% endif -%}
|
||||
{% if fax %}'''+_('Fax')+''': {{ fax }}<br>{% endif -%}
|
||||
{% if email_id %}'''+_('Email')+''': {{ email_id }}<br>{% endif -%}'''
|
@ -1,27 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
test_records = frappe.get_test_records('Address Template')
|
||||
|
||||
import unittest
|
||||
import frappe
|
||||
|
||||
class TestAddressTemplate(unittest.TestCase):
|
||||
def test_default_is_unset(self):
|
||||
a = frappe.get_doc("Address Template", "India")
|
||||
a.is_default = 1
|
||||
a.save()
|
||||
|
||||
b = frappe.get_doc("Address Template", "Brazil")
|
||||
b.is_default = 1
|
||||
b.save()
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Address Template", "India", "is_default"), 0)
|
||||
|
||||
def tearDown(self):
|
||||
a = frappe.get_doc("Address Template", "India")
|
||||
a.is_default = 1
|
||||
a.save()
|
@ -1,13 +0,0 @@
|
||||
[
|
||||
{
|
||||
"country": "India",
|
||||
"is_default": 1,
|
||||
"template": "{{ address_title }}<br>\n{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif %}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif %}\n{% if pincode %} PIN / ZIP: {{ pincode }}<br>{% endif %}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif %}\n{% if fax %}Fax: {{ fax }}<br>{% endif %}\n{% if email_id %}Email: {{ email_id }}<br>{% endif %}\n"
|
||||
},
|
||||
{
|
||||
"country": "Brazil",
|
||||
"is_default": 0,
|
||||
"template": "{{ address_title }}<br>\n{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif %}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif %}\n{% if pincode %} PIN / ZIP: {{ pincode }}<br>{% endif %}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif %}\n{% if fax %}Fax: {{ fax }}<br>{% endif %}\n{% if email_id %}Email: {{ email_id }}<br>{% endif %}\n"
|
||||
}
|
||||
]
|
||||
|
@ -1 +0,0 @@
|
||||
Contact representing a Customer or Supplier.
|
@ -1,39 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def match_email_to_contact(doc,method=None):
|
||||
if doc.communication_type == "Communication":
|
||||
origin_contact = frappe.db.sql(
|
||||
"select name, email_id, supplier, supplier_name, customer, customer_name, user, organisation from `tabContact` where email_id <>''",
|
||||
as_dict=1)
|
||||
for comm in origin_contact:
|
||||
if comm.email_id:
|
||||
if (doc.sender and doc.sent_or_received == "Received" and doc.sender.find(comm.email_id) > -1) or (
|
||||
doc.recipients and doc.sent_or_received == "Sent" and doc.recipients.find(
|
||||
comm.email_id) > -1):
|
||||
if sum(1 for x in [comm.supplier, comm.customer, comm.user, comm.organisation] if x) > 1:
|
||||
doc.db_set("timeline_doctype", "Contact")
|
||||
doc.db_set("timeline_name", comm.name)
|
||||
doc.db_set("timeline_label", doc.name)
|
||||
|
||||
elif comm.supplier:
|
||||
doc.db_set("timeline_doctype", "Supplier")
|
||||
doc.db_set("timeline_name", comm.supplier)
|
||||
doc.db_set("timeline_label", comm.supplier_name)
|
||||
|
||||
elif comm.customer:
|
||||
doc.db_set("timeline_doctype", "Customer")
|
||||
doc.db_set("timeline_name", comm.customer)
|
||||
doc.db_set("timeline_label", comm.customer_name)
|
||||
elif comm.user:
|
||||
doc.db_set("timeline_doctype", "User")
|
||||
doc.db_set("timeline_name", comm.user)
|
||||
doc.db_set("timeline_label", comm.user)
|
||||
elif comm.organisation:
|
||||
doc.db_set("timeline_doctype", "Organisation")
|
||||
doc.db_set("timeline_name", comm.organisation)
|
||||
doc.db_set("timeline_label", comm.organisation)
|
||||
else:
|
||||
doc.db_set("timeline_doctype", None)
|
||||
doc.db_set("timeline_name", None)
|
||||
doc.db_set("timeline_label", None)
|
@ -1,65 +0,0 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
{% include 'erpnext/controllers/js/contact_address_common.js' %};
|
||||
|
||||
cur_frm.email_field = "email_id";
|
||||
frappe.ui.form.on("Contact", {
|
||||
onload:function(frm){
|
||||
if(frappe.route_titles["update_contact"])
|
||||
{
|
||||
frappe.confirm("change email address from "+cur_frm.doc.email_id+ " to "+frappe.route_titles["update_contact"]["email_id"]
|
||||
,function(){
|
||||
cur_frm.doc.email_id = frappe.route_titles["update_contact"]["email_id"];
|
||||
cur_frm.refresh();
|
||||
cur_frm.dirty();
|
||||
delete frappe.route_titles["update_contact"];
|
||||
},function(){
|
||||
delete frappe.route_titles["update_contact"];
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if(!frm.doc.user && !frm.is_new() && frm.perm[0].write) {
|
||||
frm.add_custom_button(__("Invite as User"), function() {
|
||||
frappe.call({
|
||||
method: "erpnext.utilities.doctype.contact.contact.invite_user",
|
||||
args: {
|
||||
contact: frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
frm.set_value("user", r.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
validate: function(frm) {
|
||||
// clear linked customer / supplier / sales partner on saving...
|
||||
$.each(["Customer", "Supplier", "Sales Partner"], function(i, doctype) {
|
||||
var name = frm.doc[doctype.toLowerCase().replace(/ /g, "_")];
|
||||
if(name && locals[doctype] && locals[doctype][name])
|
||||
frappe.model.remove_from_locals(doctype, name);
|
||||
});
|
||||
var fieldlist = ["supplier","customer","user","organisation"]
|
||||
if(frappe.route_titles["create_contact"]==1&&!($.map(fieldlist,function(v){return frm.doc[v]?true:false}).indexOf(true)!=-1)){
|
||||
$.each(fieldlist,function(i,v){
|
||||
cur_frm.set_df_property(v,"reqd",1);
|
||||
})
|
||||
|
||||
} else {
|
||||
$.each(fieldlist,function(i,v){
|
||||
cur_frm.set_df_property(v,"reqd",0);
|
||||
})
|
||||
}
|
||||
},
|
||||
after_save:function(frm){
|
||||
if (frappe.route_titles["create_contact"])
|
||||
{
|
||||
delete frappe.route_titles["create_contact"]
|
||||
frappe.set_route("email_inbox");
|
||||
frappe.pages['email_inbox'].Inbox.run()
|
||||
}
|
||||
}
|
||||
});
|
@ -1,950 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"beta": 0,
|
||||
"creation": "2013-01-10 16:34:32",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 0,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "contact_section",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "fa fa-user",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "first_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "First Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "first_name",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "last_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Last Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "last_name",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "email_id",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Email Address",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "email_id",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Email",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cb00",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "Passive",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Status",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Passive\nOpen\nReplied",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "phone",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Phone",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "contact_no",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "image",
|
||||
"fieldtype": "Attach Image",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Image",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "contact_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reference",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "fa fa-pushpin",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "user",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "User Id",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "User",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "customer",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Customer",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "customer_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Supplier",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "supplier_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplier Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "sales_partner",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Partner",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Partner",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "organisation",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Organisation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Organisation",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"depends_on": "eval:(doc.customer || doc.supplier || doc.sales_partner)",
|
||||
"fieldname": "is_primary_contact",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Primary Contact",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "is_primary_contact",
|
||||
"oldfieldtype": "Select",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "more_info",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "More Information",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "fa fa-file-text",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "mobile_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Mobile No",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "mobile_no",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "Enter department to which this Contact belongs",
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Department",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "Enter designation of this Contact",
|
||||
"fieldname": "designation",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Designation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "unsubscribed",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Unsubscribed",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-user",
|
||||
"idx": 1,
|
||||
"image_field": "image",
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-12-22 13:46:02.655141",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Utilities",
|
||||
"name": "Contact",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Master Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Purchase Master Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Purchase Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Maintenance Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Purchase User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Maintenance User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "All",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_order": "ASC",
|
||||
"track_seen": 0
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import cstr, has_gravatar
|
||||
from frappe import _
|
||||
|
||||
from erpnext.controllers.status_updater import StatusUpdater
|
||||
|
||||
class Contact(StatusUpdater):
|
||||
def autoname(self):
|
||||
# concat first and last name
|
||||
self.name = " ".join(filter(None,
|
||||
[cstr(self.get(f)).strip() for f in ["first_name", "last_name"]]))
|
||||
|
||||
# concat party name if reqd
|
||||
for fieldname in ("customer", "supplier", "sales_partner", "organisation"):
|
||||
if self.get(fieldname):
|
||||
self.name = self.name + "-" + cstr(self.get(fieldname)).strip()
|
||||
break
|
||||
|
||||
def validate(self):
|
||||
self.set_status()
|
||||
self.validate_primary_contact()
|
||||
self.set_user()
|
||||
if self.email_id:
|
||||
self.image = has_gravatar(self.email_id)
|
||||
self.contact_update_communication_ref()
|
||||
|
||||
def set_user(self):
|
||||
if not self.user and self.email_id:
|
||||
self.user = frappe.db.get_value("User", {"email": self.email_id})
|
||||
|
||||
def validate_primary_contact(self):
|
||||
if self.is_primary_contact == 1:
|
||||
if self.customer:
|
||||
frappe.db.sql("update tabContact set is_primary_contact=0 where customer = %s",
|
||||
(self.customer))
|
||||
elif self.supplier:
|
||||
frappe.db.sql("update tabContact set is_primary_contact=0 where supplier = %s",
|
||||
(self.supplier))
|
||||
elif self.sales_partner:
|
||||
frappe.db.sql("""update tabContact set is_primary_contact=0
|
||||
where sales_partner = %s""", (self.sales_partner))
|
||||
else:
|
||||
if self.customer:
|
||||
if not frappe.db.sql("select name from tabContact \
|
||||
where is_primary_contact=1 and customer = %s", (self.customer)):
|
||||
self.is_primary_contact = 1
|
||||
elif self.supplier:
|
||||
if not frappe.db.sql("select name from tabContact \
|
||||
where is_primary_contact=1 and supplier = %s", (self.supplier)):
|
||||
self.is_primary_contact = 1
|
||||
elif self.sales_partner:
|
||||
if not frappe.db.sql("select name from tabContact \
|
||||
where is_primary_contact=1 and sales_partner = %s",
|
||||
self.sales_partner):
|
||||
self.is_primary_contact = 1
|
||||
|
||||
def on_trash(self):
|
||||
frappe.db.sql("""update `tabIssue` set contact='' where contact=%s""",
|
||||
self.name)
|
||||
|
||||
def contact_update_communication_ref(self):
|
||||
origin_communication = frappe.db.sql("select name, sender,recipients,sent_or_received from `tabCommunication`",
|
||||
as_dict=1)
|
||||
|
||||
if self.email_id:
|
||||
self.email_id = self.email_id.lower()
|
||||
comm = frappe._dict({"email_id": self.email_id,
|
||||
"name": self.name,
|
||||
"supplier": self.supplier,
|
||||
"supplier_name": self.supplier_name,
|
||||
"customer": self.customer,
|
||||
"customer_name": self.customer_name,
|
||||
"user": self.user,
|
||||
"organisation": self.organisation
|
||||
})
|
||||
for communication in origin_communication:
|
||||
sender = communication.sender
|
||||
recipients = communication.recipients
|
||||
if comm.email_id:
|
||||
if (sender and communication.sent_or_received == "Received" and sender.find(
|
||||
comm.email_id) > -1) or (
|
||||
recipients and communication.sent_or_received == "Sent" and recipients.find(
|
||||
comm.email_id) > -1):
|
||||
if sum(1 for x in [comm.supplier, comm.customer, comm.user, comm.organisation] if x) > 1:
|
||||
frappe.db.sql("""update `tabCommunication`
|
||||
set timeline_doctype = %(timeline_doctype)s,
|
||||
timeline_name = %(timeline_name)s,
|
||||
timeline_label = %(timeline_label)s
|
||||
where name = %(name)s""", {
|
||||
"timeline_doctype": "Contact",
|
||||
"timeline_name": comm.name,
|
||||
"timeline_label": self.name,
|
||||
"name": communication.name
|
||||
})
|
||||
|
||||
elif comm.supplier:
|
||||
frappe.db.sql("""update `tabCommunication`
|
||||
set timeline_doctype = %(timeline_doctype)s,
|
||||
timeline_name = %(timeline_name)s,
|
||||
timeline_label = %(timeline_label)s
|
||||
where name = %(name)s""", {
|
||||
"timeline_doctype": "Supplier",
|
||||
"timeline_name": comm.supplier,
|
||||
"timeline_label": comm.supplier_name,
|
||||
"name": communication.name
|
||||
})
|
||||
|
||||
elif comm.customer:
|
||||
|
||||
frappe.db.sql("""update `tabCommunication`
|
||||
set timeline_doctype = %(timeline_doctype)s,
|
||||
timeline_name = %(timeline_name)s,
|
||||
timeline_label = %(timeline_label)s
|
||||
where name = %(name)s""", {
|
||||
"timeline_doctype": "Customer",
|
||||
"timeline_name": comm.customer,
|
||||
"timeline_label": comm.customer_name,
|
||||
"name": communication.name
|
||||
})
|
||||
elif comm.user:
|
||||
frappe.db.sql("""update `tabCommunication`
|
||||
set timeline_doctype = %(timeline_doctype)s,
|
||||
timeline_name = %(timeline_name)s,
|
||||
timeline_label = %(timeline_label)s
|
||||
where name = %(name)s""", {
|
||||
"timeline_doctype": "User",
|
||||
"timeline_name": comm.user,
|
||||
"timeline_label": comm.user,
|
||||
"name": communication.name
|
||||
})
|
||||
elif comm.organisation:
|
||||
frappe.db.sql("""update `tabCommunication`
|
||||
set timeline_doctype = %(timeline_doctype)s,
|
||||
timeline_name = %(timeline_name)s,
|
||||
timeline_label = %(timeline_label)s
|
||||
where name = %(name)s""", {
|
||||
"timeline_doctype": "Organisation",
|
||||
"timeline_name": comm.organisation,
|
||||
"timeline_label": comm.organisation,
|
||||
"name": communication.name
|
||||
})
|
||||
|
||||
@frappe.whitelist()
|
||||
def invite_user(contact):
|
||||
contact = frappe.get_doc("Contact", contact)
|
||||
|
||||
if not contact.email_id:
|
||||
frappe.throw(_("Please set Email Address"))
|
||||
|
||||
if contact.has_permission("write"):
|
||||
user = frappe.get_doc({
|
||||
"doctype": "User",
|
||||
"first_name": contact.first_name,
|
||||
"last_name": contact.last_name,
|
||||
"email": contact.email_id,
|
||||
"user_type": "Website User",
|
||||
"send_welcome_email": 1
|
||||
}).insert(ignore_permissions = True)
|
||||
|
||||
return user.name
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_contact_details(contact):
|
||||
contact = frappe.get_doc("Contact", contact)
|
||||
out = {
|
||||
"contact_person": contact.get("name"),
|
||||
"contact_display": " ".join(filter(None,
|
||||
[contact.get("first_name"), contact.get("last_name")])),
|
||||
"contact_email": contact.get("email_id"),
|
||||
"contact_mobile": contact.get("mobile_no"),
|
||||
"contact_phone": contact.get("phone"),
|
||||
"contact_designation": contact.get("designation"),
|
||||
"contact_department": contact.get("department")
|
||||
}
|
||||
return out
|
||||
|
||||
def update_contact(doc, method):
|
||||
'''Update contact when user is updated, if contact is found. Called via hooks'''
|
||||
contact_name = frappe.db.get_value("Contact", {"email_id": doc.name})
|
||||
if contact_name:
|
||||
contact = frappe.get_doc("Contact", contact_name)
|
||||
for key in ("first_name", "last_name", "phone"):
|
||||
if doc.get(key):
|
||||
contact.set(key, doc.get(key))
|
||||
contact.flags.ignore_mandatory = True
|
||||
contact.save(ignore_permissions=True)
|
@ -1,7 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
test_records = frappe.get_test_records('Contact')
|
@ -1,22 +0,0 @@
|
||||
[
|
||||
{
|
||||
"customer": "_Test Customer",
|
||||
"customer_name": "_Test Customer",
|
||||
"doctype": "Contact",
|
||||
"email_id": "test_contact_customer@example.com",
|
||||
"first_name": "_Test Contact For _Test Customer",
|
||||
"is_primary_contact": 1,
|
||||
"phone": "+91 0000000000",
|
||||
"status": "Open"
|
||||
},
|
||||
{
|
||||
"doctype": "Contact",
|
||||
"email_id": "test_contact_supplier@example.com",
|
||||
"first_name": "_Test Contact For _Test Supplier",
|
||||
"is_primary_contact": 1,
|
||||
"phone": "+91 0000000000",
|
||||
"status": "Open",
|
||||
"supplier": "_Test Supplier",
|
||||
"supplier_name": "_Test Supplier"
|
||||
}
|
||||
]
|
@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Organisation', {
|
||||
refresh: function(frm) {
|
||||
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
||||
|
||||
if(!frm.doc.__islocal) {
|
||||
erpnext.utils.render_address_and_contact(frm);
|
||||
} else {
|
||||
erpnext.utils.clear_address_and_contact(frm);
|
||||
}
|
||||
}
|
||||
});
|
@ -1,199 +0,0 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:organisation_name",
|
||||
"beta": 0,
|
||||
"creation": "2016-08-22 11:08:27.151412",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 0,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "organisation_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.__islocal",
|
||||
"fieldname": "address_contacts",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Address and Contact",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "icon-map-marker",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "address_html",
|
||||
"fieldtype": "HTML",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Address HTML",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "contact_html",
|
||||
"fieldtype": "HTML",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Contact HTML",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "HTML",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-12-23 08:33:29.997375",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Utilities",
|
||||
"name": "Organisation",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 1,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Email User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from erpnext.utilities.address_and_contact import load_address_and_contact
|
||||
|
||||
class Organisation(Document):
|
||||
def onload(self):
|
||||
"""Load address and contacts in `__onload`"""
|
||||
load_address_and_contact(self, "organisation")
|
@ -1,12 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Organisation')
|
||||
|
||||
class TestOrganisation(unittest.TestCase):
|
||||
pass
|
Loading…
x
Reference in New Issue
Block a user