mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
cleanup of notification control: now in boot
This commit is contained in:
@@ -21,7 +21,6 @@ cur_frm.cscript.other_fname = "purchase_tax_details";
|
||||
wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
|
||||
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
|
||||
wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
||||
wn.require('app/setup/doctype/notification_control/notification_control.js');
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
// set missing values in parent doc
|
||||
@@ -220,9 +219,7 @@ cur_frm.pformat.indent_no = function(doc, cdt, cdn){
|
||||
}
|
||||
|
||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
var args = {
|
||||
type: 'Purchase Order',
|
||||
doctype: 'Purchase Order'
|
||||
if(cint(wn.boot.notification_settings.purchase_order)) {
|
||||
cur_frm.email_doc(wn.boot.notification_settings.purchase_order);
|
||||
}
|
||||
cur_frm.cscript.notify(doc, args);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wn.require('app/setup/doctype/contact_control/contact_control.js');
|
||||
wn.require('app/support/doctype/communication/communication.js');
|
||||
|
||||
cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
|
||||
@@ -29,7 +28,6 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
// make contact, history list body
|
||||
//cur_frm.cscript.make_cl_body();
|
||||
cur_frm.cscript.make_hl_body();
|
||||
cur_frm.cscript.make_communication_body();
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
@@ -46,8 +44,13 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
// make lists
|
||||
cur_frm.cscript.make_address(doc,dt,dn);
|
||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||
cur_frm.cscript.render_communication_list(doc, cdt, cdn);
|
||||
cur_frm.cscript.make_history(doc,dt,dn);
|
||||
|
||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||
list: wn.model.get("Communication", {"supplier": doc.name}),
|
||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||
doc: doc
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,26 +18,23 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, msgprint, errprint
|
||||
from webnotes.utils import cint, cstr, get_defaults
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import form, msgprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType:
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
def autoname(self):
|
||||
#get default naming conventional from control panel
|
||||
supp_master_name = get_defaults()['supp_master_name']
|
||||
@@ -59,22 +56,17 @@ class DocType:
|
||||
else:
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
# ----------------------------------------
|
||||
# update credit days and limit in account
|
||||
# ----------------------------------------
|
||||
def update_credit_days_limit(self):
|
||||
sql("update tabAccount set credit_days = '%s' where name = '%s'" % (self.doc.credit_days, self.doc.name + " - " + self.get_company_abbr()))
|
||||
|
||||
|
||||
def on_update(self):
|
||||
if not self.doc.naming_series:
|
||||
self.doc.naming_series = ''
|
||||
|
||||
|
||||
# create address
|
||||
addr_flds = [self.doc.address_line1, self.doc.address_line2, self.doc.city, self.doc.state, self.doc.country, self.doc.pincode]
|
||||
address_line = "\n".join(filter(lambda x : (x!='' and x!=None),addr_flds))
|
||||
set(self.doc,'address', address_line)
|
||||
webnotes.conn.set(self.doc,'address', address_line)
|
||||
|
||||
# create account head
|
||||
self.create_account_head()
|
||||
@@ -82,12 +74,9 @@ class DocType:
|
||||
# update credit days and limit in account
|
||||
self.update_credit_days_limit()
|
||||
|
||||
|
||||
def check_state(self):
|
||||
return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
|
||||
|
||||
# ACCOUNTS
|
||||
# -------------------------------------------
|
||||
def get_payables_group(self):
|
||||
g = sql("select payables_group from tabCompany where name=%s", self.doc.company)
|
||||
g = g and g[0][0] or ''
|
||||
@@ -116,7 +105,6 @@ class DocType:
|
||||
|
||||
return self.doc.supplier_type + " - " + abbr
|
||||
|
||||
|
||||
def validate(self):
|
||||
#validation for Naming Series mandatory field...
|
||||
if get_defaults()['supp_master_name'] == 'Naming Series':
|
||||
@@ -124,9 +112,6 @@ class DocType:
|
||||
msgprint("Series is Mandatory.")
|
||||
raise Exception
|
||||
|
||||
|
||||
# create accont head - in tree under zone + territory
|
||||
# -------------------------------------------------------
|
||||
def create_account_head(self):
|
||||
if self.doc.company :
|
||||
abbr = self.get_company_abbr()
|
||||
@@ -142,7 +127,6 @@ class DocType:
|
||||
else :
|
||||
msgprint("Please select Company under which you want to create account head")
|
||||
|
||||
|
||||
def get_contacts(self,nm):
|
||||
if nm:
|
||||
contact_details =convert_to_lists(sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where supplier = '%s'"%nm))
|
||||
@@ -172,16 +156,12 @@ class DocType:
|
||||
from webnotes.model import delete_doc
|
||||
delete_doc('Account', acc[0][0])
|
||||
|
||||
|
||||
def on_trash(self):
|
||||
self.delete_supplier_address()
|
||||
self.delete_supplier_contact()
|
||||
self.delete_supplier_communication()
|
||||
self.delete_supplier_account()
|
||||
|
||||
|
||||
# on rename
|
||||
# ---------
|
||||
def on_rename(self,newdn,olddn):
|
||||
#update supplier_name if not naming series
|
||||
if get_defaults().get('supp_master_name') == 'Supplier Name':
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-18 20:34:42",
|
||||
"creation": "2012-11-02 17:17:04",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-07-18 17:41:49"
|
||||
"modified": "2012-11-30 10:53:32"
|
||||
},
|
||||
{
|
||||
"autoname": "naming_series:",
|
||||
"name": "__common__",
|
||||
"search_fields": "supplier_name,supplier_type",
|
||||
"module": "Buying",
|
||||
@@ -32,6 +33,16 @@
|
||||
"name": "Supplier",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts",
|
||||
"oldfieldtype": "Section Break",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Basic Info",
|
||||
"fieldname": "basic_info",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Data",
|
||||
@@ -124,7 +135,6 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Communication History",
|
||||
"fieldname": "communication_history",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
@@ -246,8 +256,7 @@
|
||||
"write": 1,
|
||||
"role": "Purchase Master Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0,
|
||||
"match": ""
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
|
||||
Reference in New Issue
Block a user