fix: Add tests

(cherry picked from commit f07f010962)
This commit is contained in:
Deepesh Garg
2021-11-25 23:58:16 +05:30
committed by mergify-bot
parent 31f95bd5d1
commit 125ce5dd6d
5 changed files with 25 additions and 38 deletions

View File

@@ -146,15 +146,16 @@ class AccountsController(TransactionBase):
self.validate_party()
self.validate_currency()
if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid"
if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
self.set_advances()
if self.doctype == 'Purchase Invoice':
self.calculate_paid_amount()
# apply tax withholding only if checked and applicable
self.set_tax_withholding()
if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid"
if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
self.set_advances()
self.set_advance_gain_or_loss()