Merge pull request #823 from expsa/payment_task

Update rental_contract.py
This commit is contained in:
zainab2097 2024-08-20 15:22:09 +03:00 committed by GitHub
commit a1eb07cc2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -556,7 +556,10 @@ class RentalContract(models.Model):
rent_amount_per_payment = self.cal_rent_amount / (rent_factor / months)
water_amount_per_payment = self.water_cost / (rent_factor / service_months)
services_amount_per_payment = self.service_amount / (rent_factor / service_months)
untaxed_amount = round(rent_amount_per_payment + water_amount_per_payment + services_amount_per_payment, 2)
tax_amount = round(self.tax_id.amount / 100 * rent_amount_per_payment, 2)
total_amount = round(untaxed_amount + tax_amount, 2)
next_date = date_from
service_next_date = date_from
payment = 0
@ -568,9 +571,7 @@ class RentalContract(models.Model):
if raise_line:
rent_amount_per_payment = raise_line.rent_amount_after_raise / (rent_factor / months)
# Calculate the amounts
untaxed_amount = round(rent_amount_per_payment + water_amount_per_payment + services_amount_per_payment, 2)
tax_amount = round(self.tax_id.amount / 100 * rent_amount_per_payment, 2)
total_amount = round(untaxed_amount + tax_amount, 2)
# Insert rent payment line
self._cr.execute('INSERT INTO rent_payment \
(name, contract_id, due_date, property_id, amount, water_cost, service_cost, user_id, company_id, state, tax_id, untaxed_amount, tax_amount, total_amount) \