frappe.db.exist used
This commit is contained in:
parent
adfdd6f83c
commit
50763d58ce
@ -443,8 +443,11 @@ class JournalEntry(AccountsController):
|
|||||||
Pending Amount is {2}".format(d.idx, d.against_expense_claim, pending_amount)))
|
Pending Amount is {2}".format(d.idx, d.against_expense_claim, pending_amount)))
|
||||||
|
|
||||||
def validate_credit_debit_note(self):
|
def validate_credit_debit_note(self):
|
||||||
count = frappe.db.sql("select count(stock_entry) as c from `tabJournal Entry` where \
|
count = frappe.db.exists({
|
||||||
stock_entry = %s and docstatus = 1", self.stock_entry, as_dict=1)[0].c
|
"doctype": "Journal Entry",
|
||||||
|
"stock_entry":self.stock_entry,
|
||||||
|
"docstatus":1
|
||||||
|
})
|
||||||
if count:
|
if count:
|
||||||
frappe.throw(_("{0} already made against stock entry {1}".format(self.voucher_type, self.stock_entry)))
|
frappe.throw(_("{0} already made against stock entry {1}".format(self.voucher_type, self.stock_entry)))
|
||||||
|
|
||||||
|
|||||||
@ -35,9 +35,15 @@ class StockEntry(StockController):
|
|||||||
item.update(get_available_qty(item.item_code,
|
item.update(get_available_qty(item.item_code,
|
||||||
item.s_warehouse))
|
item.s_warehouse))
|
||||||
|
|
||||||
count = frappe.db.sql("select count(stock_entry) as c from `tabJournal Entry` \
|
count = frappe.db.exists({
|
||||||
where stock_entry = %s and docstatus = 1",self.name, as_dict=1)[0].c
|
"doctype": "Journal Entry",
|
||||||
self.get("__onload").credit_debit_note_exists = count
|
"stock_entry":self.stock_entry,
|
||||||
|
"docstatus":1
|
||||||
|
})
|
||||||
|
if count:
|
||||||
|
self.get("__onload").credit_debit_note_exists = 1
|
||||||
|
else:
|
||||||
|
self.get("__onload").credit_debit_note_exists = 0
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_posting_time()
|
self.validate_posting_time()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user