File tree 2 files changed +8
-8
lines changed
accounts/doctype/purchase_invoice
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -399,6 +399,8 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
399
399
hide_fields ( this . frm . doc ) ;
400
400
if ( cint ( this . frm . doc . is_paid ) ) {
401
401
this . frm . set_value ( "allocate_advances_automatically" , 0 ) ;
402
+ this . frm . set_value ( "payment_terms_template" , "" ) ;
403
+ this . frm . set_value ( "payment_schedule" , [ ] ) ;
402
404
if ( ! this . frm . doc . company ) {
403
405
this . frm . set_value ( "is_paid" , 0 ) ;
404
406
frappe . msgprint ( __ ( "Please specify Company to proceed" ) ) ;
Original file line number Diff line number Diff line change @@ -464,10 +464,14 @@ def validate_deferred_start_and_end_date(self):
464
464
)
465
465
466
466
def validate_invoice_documents_schedule (self ):
467
- if self .is_return :
467
+ if (
468
+ self .is_return
469
+ or (self .doctype == "Purchase Invoice" and self .is_paid )
470
+ or (self .doctype == "Sales Invoice" and self .is_pos )
471
+ or self .get ("is_opening" ) == "Yes"
472
+ ):
468
473
self .payment_terms_template = ""
469
474
self .payment_schedule = []
470
- return
471
475
472
476
self .validate_payment_schedule_dates ()
473
477
self .set_due_date ()
@@ -2342,9 +2346,6 @@ def validate_payment_schedule_dates(self):
2342
2346
dates = []
2343
2347
li = []
2344
2348
2345
- if self .doctype == "Sales Invoice" and self .is_pos :
2346
- return
2347
-
2348
2349
for d in self .get ("payment_schedule" ):
2349
2350
if self .doctype == "Sales Order" and getdate (d .due_date ) < getdate (self .transaction_date ):
2350
2351
frappe .throw (
@@ -2361,9 +2362,6 @@ def validate_payment_schedule_dates(self):
2361
2362
frappe .throw (_ ("Rows with duplicate due dates in other rows were found: {0}" ).format (duplicates ))
2362
2363
2363
2364
def validate_payment_schedule_amount (self ):
2364
- if (self .doctype == "Sales Invoice" and self .is_pos ) or self .get ("is_opening" ) == "Yes" :
2365
- return
2366
-
2367
2365
party_account_currency = self .get ("party_account_currency" )
2368
2366
if not party_account_currency :
2369
2367
party_type , party = self .get_party ()
You can’t perform that action at this time.
0 commit comments