mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
fix: don't show transfer button if already items are supplied (#20154)
This commit is contained in:
@@ -134,7 +134,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
if (doc.status != "On Hold") {
|
if (doc.status != "On Hold") {
|
||||||
if(flt(doc.per_received, 2) < 100 && allow_receipt) {
|
if(flt(doc.per_received, 2) < 100 && allow_receipt) {
|
||||||
cur_frm.add_custom_button(__('Receipt'), this.make_purchase_receipt, __('Create'));
|
cur_frm.add_custom_button(__('Receipt'), this.make_purchase_receipt, __('Create'));
|
||||||
if(doc.is_subcontracted==="Yes") {
|
if(doc.is_subcontracted==="Yes" && me.has_unsupplied_items()) {
|
||||||
cur_frm.add_custom_button(__('Material to Supplier'),
|
cur_frm.add_custom_button(__('Material to Supplier'),
|
||||||
function() { me.make_stock_entry(); }, __("Transfer"));
|
function() { me.make_stock_entry(); }, __("Transfer"));
|
||||||
}
|
}
|
||||||
@@ -191,6 +191,10 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
set_schedule_date(this.frm);
|
set_schedule_date(this.frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
has_unsupplied_items: function() {
|
||||||
|
return this.frm.doc['supplied_items'].some(item => item.required_qty != item.supplied_qty)
|
||||||
|
},
|
||||||
|
|
||||||
make_stock_entry: function() {
|
make_stock_entry: function() {
|
||||||
var items = $.map(cur_frm.doc.items, function(d) { return d.bom ? d.item_code : false; });
|
var items = $.map(cur_frm.doc.items, function(d) { return d.bom ? d.item_code : false; });
|
||||||
var me = this;
|
var me = this;
|
||||||
@@ -267,7 +271,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
|||||||
|
|
||||||
if (me.frm.doc['supplied_items']) {
|
if (me.frm.doc['supplied_items']) {
|
||||||
me.frm.doc['supplied_items'].forEach((item, index) => {
|
me.frm.doc['supplied_items'].forEach((item, index) => {
|
||||||
if (item.rm_item_code && item.main_item_code) {
|
if (item.rm_item_code && item.main_item_code && item.required_qty - item.supplied_qty != 0) {
|
||||||
me.raw_material_data.push ({
|
me.raw_material_data.push ({
|
||||||
'name':item.name,
|
'name':item.name,
|
||||||
'item_code': item.main_item_code,
|
'item_code': item.main_item_code,
|
||||||
|
|||||||
Reference in New Issue
Block a user