fix post move liquidation

This commit is contained in:
Wilson Gomez 2022-12-23 09:34:32 -05:00
parent c029e82dcd
commit f635cc5cf7

View file

@ -156,7 +156,6 @@ class Liquidation(Workflow, ModelSQL, ModelView):
def default_state():
return 'draft'
@staticmethod
def default_currency():
Company = Pool().get('company.company')
@ -357,7 +356,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
for moveline in line.move_lines:
to_reconcile.append(moveline)
account_id = moveline.account.id
amount_line = abs(moveline.debit - moveline.credit)
amount_line = moveline.debit - moveline.credit * -1
if account_id not in grouped.keys():
grouped[account_id] = {
'amount': [],
@ -428,7 +427,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
'party': party_id,
}
if analytic:
res['analytic_lines']= [
res['analytic_lines'] = [
('create', [{
'debit': res['debit'],
'credit': res['credit'],
@ -598,7 +597,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
('origin', 'in', ['staff.loan.line,' + str(m)]),
])
party = m.loan.party_to_pay.id if m.loan.party_to_pay else None
res = self.get_line_(m.loan.wage_type, m.amount, 1, m.loan.account_debit.id, party=party)
res = self.get_line_(m.loan.wage_type, m.amount * -1, 1, m.loan.account_debit.id, party=party)
res['move_lines'] = [('add', move_lines)]
res['liquidation'] = self.id
line_, = LiquidationLine.create([res])