@@ -48,7 +48,7 @@ frappe.ui.form.on("Request for Quotation",{
48
48
} ) ;
49
49
} ) ;
50
50
}
51
-
51
+
52
52
} ,
53
53
54
54
make_suppplier_quotation : function ( frm ) {
@@ -124,24 +124,28 @@ frappe.ui.form.on("Request for Quotation Supplier",{
124
124
125
125
erpnext . buying . RequestforQuotationController = erpnext . buying . BuyingController . extend ( {
126
126
refresh : function ( ) {
127
+ var me = this ;
127
128
this . _super ( ) ;
128
129
if ( this . frm . doc . docstatus === 0 ) {
129
- cur_frm . add_custom_button ( __ ( 'Material Request' ) ,
130
+ this . frm . add_custom_button ( __ ( 'Material Request' ) ,
130
131
function ( ) {
131
132
erpnext . utils . map_current_doc ( {
132
133
method : "erpnext.stock.doctype.material_request.material_request.make_request_for_quotation" ,
133
134
source_doctype : "Material Request" ,
135
+ target : me . frm ,
136
+ setters : {
137
+ company : me . frm . doc . company
138
+ } ,
134
139
get_query_filters : {
135
140
material_request_type : "Purchase" ,
136
141
docstatus : 1 ,
137
142
status : [ "!=" , "Stopped" ] ,
138
- per_ordered : [ "<" , 99.99 ] ,
139
- company : cur_frm . doc . company
143
+ per_ordered : [ "<" , 99.99 ]
140
144
}
141
145
} )
142
146
} , __ ( "Get items from" ) ) ;
143
147
// Get items from open Material Requests based on supplier
144
- cur_frm . add_custom_button ( __ ( 'Possible Supplier' ) , function ( ) {
148
+ this . frm . add_custom_button ( __ ( 'Possible Supplier' ) , function ( ) {
145
149
// Create a dialog window for the user to pick their supplier
146
150
var d = new frappe . ui . Dialog ( {
147
151
title : __ ( 'Select Possible Supplier' ) ,
@@ -150,32 +154,35 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e
150
154
{ fieldname : 'ok_button' , fieldtype :'Button' , label :'Get Items from Material Requests' } ,
151
155
]
152
156
} ) ;
153
-
157
+
154
158
// On the user clicking the ok button
155
159
d . fields_dict . ok_button . input . onclick = function ( ) {
156
160
var btn = d . fields_dict . ok_button . input ;
157
161
var v = d . get_values ( ) ;
158
162
if ( v ) {
159
163
$ ( btn ) . set_working ( ) ;
160
-
164
+
161
165
erpnext . utils . map_current_doc ( {
162
166
method : "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_item_from_material_requests_based_on_supplier" ,
163
167
source_name : v . supplier ,
168
+ target : me . frm ,
169
+ setters : {
170
+ company : me . frm . doc . company
171
+ } ,
164
172
get_query_filters : {
165
173
material_request_type : "Purchase" ,
166
174
docstatus : 1 ,
167
175
status : [ "!=" , "Stopped" ] ,
168
- per_ordered : [ "<" , 99.99 ] ,
169
- company : cur_frm . doc . company
176
+ per_ordered : [ "<" , 99.99 ]
170
177
}
171
178
} ) ;
172
179
$ ( btn ) . done_working ( ) ;
173
180
d . hide ( ) ;
174
181
}
175
- }
182
+ }
176
183
d . show ( ) ;
177
184
} , __ ( "Get items from" ) ) ;
178
-
185
+
179
186
}
180
187
} ,
181
188
0 commit comments