minor fix

This commit is contained in:
wilson gomez sanchez 2021-03-10 14:45:28 -05:00
parent c75386b43f
commit e536523bda
1 changed files with 11 additions and 9 deletions

View File

@ -86,6 +86,17 @@ class PayrollLine(metaclass=PoolMeta):
move_lines = fields.Many2Many('staff.payroll.line-move.line',
'line', 'move_line', 'Payroll Line - Move Line')
def get_expense_amount(self):
expense = super(PayrollLine, self).get_expense_amount()
if self.wage_type.round_amounts:
if self.wage_type.round_amounts == 'above_amount':
expense = math.ceil(float(expense) / 100.0) * 100
elif self.wage_type.round_amounts == 'under_amount':
expense = math.floor(float(expense) / 100.0) * 100
elif self.wage_type.round_amounts == 'automatic':
expense = round(expense, -2)
return expense
class PayrollLineMoveLine(ModelSQL):
"Payroll Line - MoveLine"
@ -400,15 +411,6 @@ class Payroll(metaclass=PoolMeta):
res = super(Payroll, self).get_line(wage, qty, unit_value, party)
return res
def get_expense_amount(self):
expense = super(Payroll, self).get_expense_amount()
if self.wage_type.expense_formula:
salary_args = self.payroll.get_salary_full(self.wage_type)
expense = self.wage_type.compute_expense(salary_args)
if self.wage_type.round_amounts:
expense = self.get_round_amount(self.wage_type, expense)
return expense
def set_preliquidation(self, extras, discounts=None):
discounts = self.set_events()
ctx = {