[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) {
|
refresh: function(doc, dt, dn) {
|
||||||
this._super();
|
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)
|
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
|
||||||
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);
|
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);
|
||||||
|
@ -50,6 +50,13 @@ class DocType(SellingController):
|
|||||||
'keyword': 'Delivered'
|
'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):
|
def get_contact_details(self):
|
||||||
return get_obj('Sales Common').get_contact_details(self,0)
|
return get_obj('Sales Common').get_contact_details(self,0)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
if(this.frm.doc.docstatus == 1) {
|
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',
|
cur_frm.add_custom_button('Make Purchase Invoice',
|
||||||
this.make_purchase_invoice);
|
this.make_purchase_invoice);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,13 @@ class DocType(BuyingController):
|
|||||||
'source_field': 'qty',
|
'source_field': 'qty',
|
||||||
'percent_join_field': 'prevdoc_docname',
|
'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
|
# get available qty at warehouse
|
||||||
def get_bin_details(self, arg = ''):
|
def get_bin_details(self, arg = ''):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user