File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -489,18 +489,28 @@ erpnext.sales_common = {
489489 }
490490
491491 project ( doc , cdt , cdn ) {
492- const item = frappe . get_doc ( cdt , cdn ) ;
493- if ( item . project ) {
494- $ . each ( this . frm . doc [ "items" ] || [ ] , function ( i , other_item ) {
495- if ( ! other_item . project ) {
496- frappe . model . set_value (
497- other_item . doctype ,
498- other_item . name ,
499- "project" ,
500- item . project
501- ) ;
502- }
503- } ) ;
492+ if ( ! cdt || ! cdn ) {
493+ if ( this . frm . doc . project ) {
494+ $ . each ( this . frm . doc [ "items" ] || [ ] , function ( i , item ) {
495+ if ( ! item . project ) {
496+ frappe . model . set_value ( item . doctype , item . name , "project" , doc . project ) ;
497+ }
498+ } ) ;
499+ }
500+ } else {
501+ const item = frappe . get_doc ( cdt , cdn ) ;
502+ if ( item . project ) {
503+ $ . each ( this . frm . doc [ "items" ] || [ ] , function ( i , other_item ) {
504+ if ( ! other_item . project ) {
505+ frappe . model . set_value (
506+ other_item . doctype ,
507+ other_item . name ,
508+ "project" ,
509+ item . project
510+ ) ;
511+ }
512+ } ) ;
513+ }
504514 }
505515 let me = this ;
506516 if ( [ "Delivery Note" , "Sales Invoice" , "Sales Order" ] . includes ( this . frm . doc . doctype ) ) {
You can’t perform that action at this time.
0 commit comments