I'm trying to perform the both operations at the same time but only one is getting returned at a time. If I remove either of them, the other one get performed. Is there any way round to get both of them working at the same time? I'm talking about grossannualsalary and textDeduct.
class Salarie(models.Model):
grossmonthlysalary = models.FloatField(
_('Monthly Salary'),
null=False,
blank=False,
default=0.00
)
monthlyincometax = models.FloatField(
_('Monthly Income Tax'),
null=False,
blank=False
)
contractperiod = models.IntegerField(
_('Contract Period'),
null=False,
blank=False
)
grossannualsalary = models.FloatField(
_('Gross Annual Salary'),
null=True,
blank=True
)
taxDeduct = models.FloatField(
_('Tax Deduction'),
null=False,
blank=False,
default=0.00
)
def save(self, *args, **kwargs):
self.grossannualsalary = self.grossmonthlysalary * self.contractperiod
super(Salarie, self).save(*args, **kwargs)
def save(self, *args, **kwargs):
self.taxDeduct = self.grossmonthlysalary * self.monthlyincometax / 100
super(Salarie, self).save(*args, **kwargs)