small fixes: sms, quotation messages etc
This commit is contained in:
parent
221f03be01
commit
22c3f63edd
@ -174,16 +174,20 @@ class DocType(TransactionBase):
|
|||||||
def get_customer_account(self):
|
def get_customer_account(self):
|
||||||
"""Get Account Head to which amount needs to be Debited based on Customer"""
|
"""Get Account Head to which amount needs to be Debited based on Customer"""
|
||||||
if not self.doc.company:
|
if not self.doc.company:
|
||||||
msgprint("Please select company first and re-select the customer after doing so", raise_exception=1)
|
msgprint("Please select company first and re-select the customer after doing so",
|
||||||
|
raise_exception=1)
|
||||||
|
if self.doc.customer:
|
||||||
|
acc_head = webnotes.conn.sql("""select name from `tabAccount`
|
||||||
|
where (name = %s or (master_name = %s and master_type = 'customer'))
|
||||||
|
and docstatus != 2""",
|
||||||
|
(cstr(self.doc.customer) + " - " + self.get_company_abbr(), self.doc.customer))
|
||||||
|
|
||||||
acc_head = webnotes.conn.sql("""select name from `tabAccount`
|
if acc_head and acc_head[0][0]:
|
||||||
where (name = %s or (master_name = %s and master_type = 'customer')) and docstatus != 2""",
|
return acc_head[0][0]
|
||||||
(cstr(self.doc.customer) + " - " + self.get_company_abbr(),self.doc.customer))
|
else:
|
||||||
|
msgprint("%s does not have an Account Head in %s. \
|
||||||
if acc_head and acc_head[0][0]:
|
You must first create it from the Customer Master" %
|
||||||
return acc_head[0][0]
|
(self.doc.customer, self.doc.company))
|
||||||
else:
|
|
||||||
msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
|
|
||||||
|
|
||||||
def get_debit_to(self):
|
def get_debit_to(self):
|
||||||
acc_head = self.get_customer_account()
|
acc_head = self.get_customer_account()
|
||||||
|
@ -147,7 +147,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
|
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
|
||||||
var callback = function(r,rt){
|
var callback = function(r,rt){
|
||||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||||
if(r.message){
|
if(!r.exc){
|
||||||
doc.quotation_no = r.message;
|
doc.quotation_no = r.message;
|
||||||
if(doc.quotation_no) {
|
if(doc.quotation_no) {
|
||||||
unhide_field(['quotation_date', 'customer_address', 'contact_person', 'territory', 'customer_group']);
|
unhide_field(['quotation_date', 'customer_address', 'contact_person', 'territory', 'customer_group']);
|
||||||
|
@ -194,11 +194,11 @@ class DocType(TransactionBase):
|
|||||||
# Validations of Details Table
|
# Validations of Details Table
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
def validate_for_items(self):
|
def validate_for_items(self):
|
||||||
check_list,flag = [],0
|
check_list, flag = [], 0
|
||||||
chk_dupl_itm = []
|
chk_dupl_itm = []
|
||||||
# Sales Order Items Validations
|
# Sales Order Items Validations
|
||||||
for d in getlist(self.doclist, 'sales_order_details'):
|
for d in getlist(self.doclist, 'sales_order_details'):
|
||||||
if cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
|
if self.doc.quotation_no and cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
|
||||||
flag = 1
|
flag = 1
|
||||||
if d.prevdoc_docname:
|
if d.prevdoc_docname:
|
||||||
if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
|
if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
|
||||||
@ -229,14 +229,13 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
# used for production plan
|
# used for production plan
|
||||||
d.transaction_date = self.doc.transaction_date
|
d.transaction_date = self.doc.transaction_date
|
||||||
|
|
||||||
# gets total projected qty of item in warehouse selected (this case arises when warehouse is selected b4 item)
|
tot_avail_qty = sql("select projected_qty from `tabBin` \
|
||||||
tot_avail_qty = sql("select projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
|
where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
|
||||||
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
|
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
|
||||||
|
|
||||||
if flag == 0:
|
if getlist(self.doclist, 'sales_order_details') and self.doc.quotation_no and flag == 0:
|
||||||
msgprint("There are no items of the quotation selected.")
|
msgprint("There are no items of the quotation selected", raise_exception=1)
|
||||||
raise Exception
|
|
||||||
|
|
||||||
# validate sales/ maintenance quotation against order type
|
# validate sales/ maintenance quotation against order type
|
||||||
#------------------------------------------------------------------
|
#------------------------------------------------------------------
|
||||||
|
@ -31,7 +31,6 @@ function SMSManager() {
|
|||||||
this.show = function(contact, key, value, mobile_nos, message) {
|
this.show = function(contact, key, value, mobile_nos, message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
if (mobile_nos) {
|
if (mobile_nos) {
|
||||||
|
|
||||||
me.number = mobile_nos;
|
me.number = mobile_nos;
|
||||||
me.show_dialog();
|
me.show_dialog();
|
||||||
} else if (contact){
|
} else if (contact){
|
||||||
@ -59,7 +58,6 @@ function SMSManager() {
|
|||||||
{fieldname:'send', fieldtype:'Button', label:'Send'}
|
{fieldname:'send', fieldtype:'Button', label:'Send'}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
d.make();
|
|
||||||
d.fields_dict.send.input.onclick = function() {
|
d.fields_dict.send.input.onclick = function() {
|
||||||
var btn = d.fields_dict.send.input;
|
var btn = d.fields_dict.send.input;
|
||||||
var v = me.dialog.get_values();
|
var v = me.dialog.get_values();
|
||||||
|
Loading…
Reference in New Issue
Block a user