minor fix

This commit is contained in:
Wilson Gomez 2023-01-11 09:37:50 -05:00
parent 540a6add2e
commit 5a2e06819f
1 changed files with 8 additions and 5 deletions

View File

@ -711,11 +711,14 @@ class LiquidationLine(ModelSQL, ModelView):
@fields.depends('amount', 'adjustments', 'move_lines')
def on_change_with_amount(self, name=None):
amount_ = 0
if self.adjustments:
amount_ += sum([ad.amount or 0 for ad in self.adjustments])
if self.move_lines:
amount_ += sum([(ml.credit - ml.debit) for ml in self.move_lines])
if not self.adjustments and not self.move_lines:
amount_ = self.amount
else:
amount_ = 0
if self.adjustments:
amount_ += sum([ad.amount or 0 for ad in self.adjustments])
if self.move_lines:
amount_ += sum([(ml.credit - ml.debit) for ml in self.move_lines])
return amount_
def get_average_payroll(self, name):