[MIG] account_financial_report: Migration to 15.0

This commit is contained in:
Jasmin Solanki
2022-03-16 17:30:32 +05:30
committed by chaule97
parent dba1ed1287
commit 2b45a4c62f
27 changed files with 137 additions and 220 deletions

View File

@@ -86,11 +86,11 @@ class JournalLedgerReport(models.AbstractModel):
def _get_move_lines_order(self, move_ids, wizard, journal_ids):
return ""
def _get_move_lines_data(self, ml, wizard, ml_taxes, auto_sequence):
def _get_move_lines_data(self, ml, wizard, ml_taxes, auto_sequence, exigible):
base_debit = (
base_credit
) = tax_debit = tax_credit = base_balance = tax_balance = 0.0
if ml.tax_exigible:
if exigible:
base_debit = ml_taxes and ml.debit or 0.0
base_credit = ml_taxes and ml.credit or 0.0
base_balance = ml_taxes and ml.balance or 0.0
@@ -179,6 +179,10 @@ class JournalLedgerReport(models.AbstractModel):
self._get_move_lines_domain(move_ids, wizard, journal_ids),
order=self._get_move_lines_order(move_ids, wizard, journal_ids),
)
move_lines_exigible = self.env["account.move.line"].search(
self._get_move_lines_domain(move_ids, wizard, journal_ids)
+ self.env["account.move.line"]._get_tax_exigible_domain(),
)
move_line_ids_taxes_data = {}
if move_lines:
# Get the taxes ids for the move lines
@@ -221,8 +225,9 @@ class JournalLedgerReport(models.AbstractModel):
and move_line_ids_taxes_data[ml.id]
or {}
)
exigible = ml in move_lines_exigible
Move_Lines[ml.move_id.id].append(
self._get_move_lines_data(ml, wizard, taxes, auto_sequence)
self._get_move_lines_data(ml, wizard, taxes, auto_sequence, exigible)
)
account_ids_data = self._get_account_data(accounts)
partner_ids_data = self._get_partner_data(partners)