From 1760bdc42f7c5646690f155580f2ed48452382ea Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Thu, 6 Nov 2025 16:26:44 +0500 Subject: [PATCH] fix part --- core/apps/orders/models/party.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/apps/orders/models/party.py b/core/apps/orders/models/party.py index d3457e9..6fb7810 100644 --- a/core/apps/orders/models/party.py +++ b/core/apps/orders/models/party.py @@ -97,19 +97,19 @@ class PartyAmount(BaseModel): overdue_amount = models.BigIntegerField(default=0) def save(self, *args, **kwargs): - if self.calculated_amount > 0 and self.calculated_amount < self.paid_amount: + if self.calculated_amount > 0 and self.calculated_amount <= self.paid_amount: self.overdue_amount = self.paid_amount - self.calculated_amount self.payment_amount = 0 - elif self.calculated_amount <= 0 and self.total_price < self.paid_amount: + elif self.calculated_amount <= 0 and self.total_price <= self.paid_amount: self.overdue_amount = self.paid_amount - self.total_price self.payment_amount = 0 - elif self.calculated_amount > 0 and self.calculated_amount > self.paid_amount: + elif self.calculated_amount > 0 and self.calculated_amount >= self.paid_amount: self.payment_amount = self.calculated_amount - self.paid_amount self.overdue_amount = 0 - elif self.calculated_amount <= 0 and self.total_price > self.paid_amount: + elif self.calculated_amount <= 0 and self.total_price >= self.paid_amount: self.payment_amount = self.total_price - self.paid_amount self.overdue_amount = 0 else: