pricing rule fix

This commit is contained in:
Nabin Hait 2017-04-28 15:18:26 +05:30
parent 8c9fb76854
commit 2afb9b96cd
2 changed files with 8 additions and 2 deletions

View File

@ -201,6 +201,8 @@ def remove_pricing_rule_for_item(pricing_rule, item_details):
item_details.margin_rate_or_amount = 0.0
item_details.margin_type = None
if item_details.pricing_rule:
item_details.pricing_rule = None
return item_details
@frappe.whitelist()

View File

@ -28,8 +28,12 @@ class EmployeeLoanApplication(Document):
if self.repayment_method == "Repay Fixed Amount per Period":
monthly_interest_rate = flt(self.rate_of_interest) / (12 *100)
self.repayment_periods = math.ceil((math.log(self.repayment_amount) - math.log(self.repayment_amount - \
(self.loan_amount*monthly_interest_rate)))/(math.log(1+monthly_interest_rate)))
if monthly_interest_rate:
self.repayment_periods = math.ceil((math.log(self.repayment_amount) -
math.log(self.repayment_amount - (self.loan_amount*monthly_interest_rate))) /
(math.log(1 + monthly_interest_rate)))
else:
self.repayment_periods = self.loan_amount / self.repayment_amount
self.total_payable_amount = self.repayment_amount * self.repayment_periods
self.total_payable_interest = self.total_payable_amount - self.loan_amount