[fix] [minor] get query

This commit is contained in:
Nabin Hait 2013-07-15 18:16:37 +05:30
parent da46a3782f
commit 00dadc8bd5
2 changed files with 13 additions and 7 deletions

View File

@ -135,13 +135,19 @@ class DocType(BuyingController):
raise Exception raise Exception
def validate_bill_no(self): def validate_bill_no(self):
if self.doc.bill_no and self.doc.bill_no.lower().strip() not in ['na', 'not applicable', 'none']: if self.doc.bill_no and self.doc.bill_no.lower().strip() \
b_no = sql("select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` where bill_no = '%s' and credit_to = '%s' and docstatus = 1 and name != '%s' " % (self.doc.bill_no, self.doc.credit_to, self.doc.name)) not in ['na', 'not applicable', 'none']:
b_no = sql("""select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice`
where bill_no = %s and credit_to = %s and docstatus = 1 and name != %s""",
(self.doc.bill_no, self.doc.credit_to, self.doc.name))
if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening): if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening):
msgprint("Please check you have already booked expense against Bill No. %s in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1]))) msgprint("Please check you have already booked expense against Bill No. %s \
raise Exception , "Validation Error" in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1])),
if not self.doc.remarks: raise_exception=1)
self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s" % (self.doc.bill_no, formatdate(self.doc.bill_date)))
if not self.doc.remarks and self.doc.bill_date:
self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s"
% (self.doc.bill_no, formatdate(self.doc.bill_date)))
else: else:
if not self.doc.remarks: if not self.doc.remarks:
self.doc.remarks = "No Remarks" self.doc.remarks = "No Remarks"

View File

@ -127,7 +127,7 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) {
refresh_field('row_id',d.name,'purchase_tax_details'); refresh_field('row_id',d.name,'purchase_tax_details');
} }
cur_frm.set_query("account_head", "purchase_tax_details", function() { cur_frm.set_query("account_head", "purchase_tax_details", function(doc) {
return { return {
filters: [ filters: [
["Account", "group_or_ledger", "=", "Ledger"], ["Account", "group_or_ledger", "=", "Ledger"],