Merge pull request #4643 from nabinhait/status_button
[fix] Close button visible in all sumitted PR and DN
This commit is contained in:
commit
c2c9124af8
@ -50,14 +50,12 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
|
||||
if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
|
||||
this.show_general_ledger();
|
||||
}
|
||||
if (this.frm.has_perm("submit") && (doc.status !== "Closed")
|
||||
&& this.frm.doc.__onload && this.frm.doc.__onload.has_return_entry) {
|
||||
cur_frm.add_custom_button(__("Close"), this.close_delivery_note, __("Status"))
|
||||
if (this.frm.has_perm("submit") && doc.status !== "Closed") {
|
||||
cur_frm.add_custom_button(__("Close"), this.close_delivery_note, __("Status"))
|
||||
}
|
||||
}
|
||||
|
||||
if(doc.__onload && !doc.__onload.billing_complete && doc.docstatus==1
|
||||
&& !doc.is_return && doc.status!="Closed") {
|
||||
if(doc.docstatus==1 && !doc.is_return && doc.status!="Closed" && flt(doc.per_billed) < 100) {
|
||||
// show Make Invoice button only if Delivery Note is not created from Sales Invoice
|
||||
var from_sales_invoice = false;
|
||||
from_sales_invoice = cur_frm.doc.items.some(function(item) {
|
||||
|
@ -61,10 +61,6 @@ class DeliveryNote(SellingController):
|
||||
'extra_cond': """ and exists (select name from `tabDelivery Note` where name=`tabDelivery Note Item`.parent and is_return=1)"""
|
||||
}]
|
||||
|
||||
def onload(self):
|
||||
self.set_onload("has_return_entry", len(frappe.db.exists({"doctype": "Delivery Note",
|
||||
"is_return": 1, "return_against": self.name, "docstatus": 1})))
|
||||
|
||||
def before_print(self):
|
||||
def toggle_print_hide(meta, fieldname):
|
||||
df = meta.get_field(fieldname)
|
||||
|
@ -55,14 +55,13 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
||||
}
|
||||
|
||||
if(this.frm.doc.docstatus == 1 && this.frm.doc.status!="Closed") {
|
||||
if (this.frm.has_perm("submit") &&
|
||||
this.frm.doc.__onload && this.frm.doc.__onload.has_return_entry) {
|
||||
cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt, __("Status"))
|
||||
if (this.frm.has_perm("submit")) {
|
||||
cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt, __("Status"))
|
||||
}
|
||||
|
||||
cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __("Make"));
|
||||
|
||||
if(this.frm.doc.__onload && !this.frm.doc.__onload.billing_complete) {
|
||||
if(flt(this.frm.doc.per_billed) < 100) {
|
||||
cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __("Make"));
|
||||
}
|
||||
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||
|
@ -46,16 +46,6 @@ class PurchaseReceipt(BuyingController):
|
||||
'extra_cond': """ and exists (select name from `tabPurchase Receipt` where name=`tabPurchase Receipt Item`.parent and is_return=1)"""
|
||||
}]
|
||||
|
||||
def onload(self):
|
||||
billed_qty = frappe.db.sql("""select sum(qty) from `tabPurchase Invoice Item`
|
||||
where purchase_receipt=%s and docstatus=1""", self.name)
|
||||
if billed_qty:
|
||||
total_qty = sum((item.qty for item in self.get("items")))
|
||||
self.set_onload("billing_complete", (billed_qty[0][0] == total_qty))
|
||||
|
||||
self.set_onload("has_return_entry", len(frappe.db.exists({"doctype": "Purchase Receipt",
|
||||
"is_return": 1, "return_against": self.name, "docstatus": 1})))
|
||||
|
||||
def validate(self):
|
||||
super(PurchaseReceipt, self).validate()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user