[fix] [issue] webnotes/erpnext#674 - hide Make Invoice button when invoicing of delivery/receipt is complete
This commit is contained in:
parent
d2cb598b6b
commit
18b1e202d5
@ -29,7 +29,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
|
||||
refresh: function(doc, dt, dn) {
|
||||
this._super();
|
||||
|
||||
if(flt(doc.per_billed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', this.make_sales_invoice);
|
||||
if(!doc.__billing_complete && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', this.make_sales_invoice);
|
||||
|
||||
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
|
||||
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);
|
||||
|
@ -50,6 +50,13 @@ class DocType(SellingController):
|
||||
'keyword': 'Delivered'
|
||||
}]
|
||||
|
||||
def onload(self):
|
||||
billed_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Invoice Item`
|
||||
where delivery_note=%s""", self.doc.name)
|
||||
if billed_qty:
|
||||
total_qty = sum((item.qty for item in self.doclist.get({"parentfield": "delivery_note_details"})))
|
||||
self.doc.fields["__billing_complete"] = billed_qty[0][0] == total_qty
|
||||
|
||||
def get_contact_details(self):
|
||||
return get_obj('Sales Common').get_contact_details(self,0)
|
||||
|
||||
|
@ -28,7 +28,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
||||
this._super();
|
||||
|
||||
if(this.frm.doc.docstatus == 1) {
|
||||
if(flt(this.frm.doc.per_billed, 2) < 100) {
|
||||
if(!this.frm.doc.__billing_complete) {
|
||||
cur_frm.add_custom_button('Make Purchase Invoice',
|
||||
this.make_purchase_invoice);
|
||||
}
|
||||
|
@ -44,6 +44,13 @@ class DocType(BuyingController):
|
||||
'source_field': 'qty',
|
||||
'percent_join_field': 'prevdoc_docname',
|
||||
}]
|
||||
|
||||
def onload(self):
|
||||
billed_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabPurchase Invoice Item`
|
||||
where purchase_receipt=%s""", self.doc.name)
|
||||
if billed_qty:
|
||||
total_qty = sum((item.qty for item in self.doclist.get({"parentfield": "purchase_receipt_details"})))
|
||||
self.doc.fields["__billing_complete"] = billed_qty[0][0] == total_qty
|
||||
|
||||
# get available qty at warehouse
|
||||
def get_bin_details(self, arg = ''):
|
||||
|
Loading…
x
Reference in New Issue
Block a user