@@ -181,6 +181,17 @@ class BOMConfigurator {
181181 } ,
182182 btnClass : "hidden-xs" ,
183183 } ,
184+ {
185+ label : __ ( frappe . utils . icon ( "move" , "sm" ) + " Phantom Item" ) ,
186+ click : function ( node ) {
187+ let view = frappe . views . trees [ "BOM Configurator" ] ;
188+ view . events . convert_to_sub_assembly ( node , view , true ) ;
189+ } ,
190+ condition : function ( node ) {
191+ return ! node . expandable ;
192+ } ,
193+ btnClass : "hidden-xs" ,
194+ } ,
184195 {
185196 label : __ ( frappe . utils . icon ( "delete" , "sm" ) + " Item" ) ,
186197 click : function ( node ) {
@@ -399,10 +410,10 @@ class BOMConfigurator {
399410 return fields ;
400411 }
401412
402- convert_to_sub_assembly ( node , view ) {
413+ convert_to_sub_assembly ( node , view , phantom = false ) {
403414 let dialog = new frappe . ui . Dialog ( {
404- fields : view . events . get_sub_assembly_modal_fields ( view , node . is_root , true ) ,
405- title : __ ( "Add Sub Assembly" ) ,
415+ fields : view . events . get_sub_assembly_modal_fields ( view , node . is_root , true , phantom ) ,
416+ title : phantom ? __ ( "Add Phantom Item" ) : __ ( "Add Sub Assembly" ) ,
406417 } ) ;
407418
408419 dialog . set_values ( {
@@ -415,7 +426,9 @@ class BOMConfigurator {
415426 let bom_item = dialog . get_values ( ) ;
416427
417428 if ( ! bom_item . item_code ) {
418- frappe . throw ( __ ( "Sub Assembly Item is mandatory" ) ) ;
429+ frappe . throw (
430+ phantom ? __ ( "Phantom Item is mandatory" ) : __ ( "Sub Assembly Item is mandatory" )
431+ ) ;
419432 }
420433
421434 bom_item . items . forEach ( ( d ) => {
@@ -440,6 +453,7 @@ class BOMConfigurator {
440453 workstation_type : node . data . workstation_type ,
441454 operation_time : node . data . operation_time ,
442455 workstation : node . data . workstation ,
456+ phantom : phantom ,
443457 } ,
444458 callback : ( r ) => {
445459 node . expandable = true ;
0 commit comments