[IMP] account_financial_report: extensibility: ml fields
parent
9acc89c7d1
commit
e69b6ae74c
|
@ -7,6 +7,16 @@ from odoo import api, models
|
|||
class AgedPartnerBalanceReport(models.AbstractModel):
|
||||
_name = "report.account_financial_report.abstract_report"
|
||||
_description = "Abstract Report"
|
||||
COMMON_ML_FIELDS = [
|
||||
"account_id",
|
||||
"partner_id",
|
||||
"journal_id",
|
||||
"date",
|
||||
"ref",
|
||||
"id",
|
||||
"move_id",
|
||||
"name",
|
||||
]
|
||||
|
||||
@api.model
|
||||
def _get_move_lines_domain_not_reconciled(
|
||||
|
@ -68,24 +78,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
new_domain = self._get_new_move_lines_domain(
|
||||
new_ml_ids, account_ids, company_id, partner_ids, only_posted_moves
|
||||
)
|
||||
ml_fields = [
|
||||
"id",
|
||||
"name",
|
||||
"date",
|
||||
"move_id",
|
||||
"journal_id",
|
||||
"account_id",
|
||||
"partner_id",
|
||||
"amount_residual",
|
||||
"date_maturity",
|
||||
"ref",
|
||||
"debit",
|
||||
"credit",
|
||||
"reconciled",
|
||||
"currency_id",
|
||||
"amount_currency",
|
||||
"amount_residual_currency",
|
||||
]
|
||||
ml_fields = self._get_ml_fields()
|
||||
new_move_lines = self.env["account.move.line"].search_read(
|
||||
domain=new_domain, fields=ml_fields
|
||||
)
|
||||
|
@ -124,3 +117,15 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
for journal in journals:
|
||||
journals_data.update({journal.id: {"id": journal.id, "code": journal.code}})
|
||||
return journals_data
|
||||
|
||||
def _get_ml_fields(self):
|
||||
return self.COMMON_ML_FIELDS + [
|
||||
"amount_residual",
|
||||
"reconciled",
|
||||
"currency_id",
|
||||
"credit",
|
||||
"date_maturity",
|
||||
"amount_residual_currency",
|
||||
"debit",
|
||||
"amount_currency",
|
||||
]
|
||||
|
|
|
@ -103,19 +103,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
domain = self._get_move_lines_domain_not_reconciled(
|
||||
company_id, account_ids, partner_ids, only_posted_moves, date_from
|
||||
)
|
||||
ml_fields = [
|
||||
"id",
|
||||
"name",
|
||||
"date",
|
||||
"move_id",
|
||||
"journal_id",
|
||||
"account_id",
|
||||
"partner_id",
|
||||
"amount_residual",
|
||||
"date_maturity",
|
||||
"ref",
|
||||
"reconciled",
|
||||
]
|
||||
ml_fields = self._get_ml_fields()
|
||||
line_model = self.env["account.move.line"]
|
||||
move_lines = line_model.search_read(domain=domain, fields=ml_fields)
|
||||
journals_ids = set()
|
||||
|
@ -375,3 +363,10 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
"aged_partner_balance": aged_partner_data,
|
||||
"show_move_lines_details": show_move_line_details,
|
||||
}
|
||||
|
||||
def _get_ml_fields(self):
|
||||
return self.COMMON_ML_FIELDS + [
|
||||
"amount_residual",
|
||||
"reconciled",
|
||||
"date_maturity",
|
||||
]
|
||||
|
|
|
@ -458,26 +458,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
|||
)
|
||||
if extra_domain:
|
||||
domain += extra_domain
|
||||
ml_fields = [
|
||||
"id",
|
||||
"name",
|
||||
"date",
|
||||
"move_id",
|
||||
"journal_id",
|
||||
"account_id",
|
||||
"partner_id",
|
||||
"debit",
|
||||
"credit",
|
||||
"balance",
|
||||
"currency_id",
|
||||
"full_reconcile_id",
|
||||
"tax_ids",
|
||||
"tax_line_id",
|
||||
"amount_currency",
|
||||
"ref",
|
||||
"name",
|
||||
"analytic_distribution",
|
||||
]
|
||||
ml_fields = self._get_ml_fields()
|
||||
move_lines = self.env["account.move.line"].search_read(
|
||||
domain=domain, fields=ml_fields
|
||||
)
|
||||
|
@ -880,3 +861,16 @@ class GeneralLedgerReport(models.AbstractModel):
|
|||
"filter_partner_ids": True if partner_ids else False,
|
||||
"currency_model": self.env["res.currency"],
|
||||
}
|
||||
|
||||
def _get_ml_fields(self):
|
||||
return self.COMMON_ML_FIELDS + [
|
||||
"analytic_distribution",
|
||||
"full_reconcile_id",
|
||||
"tax_line_id",
|
||||
"currency_id",
|
||||
"credit",
|
||||
"debit",
|
||||
"amount_currency",
|
||||
"balance",
|
||||
"tax_ids",
|
||||
]
|
||||
|
|
|
@ -48,24 +48,7 @@ class OpenItemsReport(models.AbstractModel):
|
|||
domain = self._get_move_lines_domain_not_reconciled(
|
||||
company_id, account_ids, partner_ids, only_posted_moves, date_from
|
||||
)
|
||||
ml_fields = [
|
||||
"id",
|
||||
"name",
|
||||
"date",
|
||||
"move_id",
|
||||
"journal_id",
|
||||
"account_id",
|
||||
"partner_id",
|
||||
"amount_residual",
|
||||
"date_maturity",
|
||||
"ref",
|
||||
"debit",
|
||||
"credit",
|
||||
"reconciled",
|
||||
"currency_id",
|
||||
"amount_currency",
|
||||
"amount_residual_currency",
|
||||
]
|
||||
ml_fields = self._get_ml_fields()
|
||||
move_lines = self.env["account.move.line"].search_read(
|
||||
domain=domain, fields=ml_fields
|
||||
)
|
||||
|
@ -272,3 +255,15 @@ class OpenItemsReport(models.AbstractModel):
|
|||
"total_amount": total_amount,
|
||||
"Open_Items": open_items_move_lines_data,
|
||||
}
|
||||
|
||||
def _get_ml_fields(self):
|
||||
return self.COMMON_ML_FIELDS + [
|
||||
"amount_residual",
|
||||
"reconciled",
|
||||
"currency_id",
|
||||
"credit",
|
||||
"date_maturity",
|
||||
"amount_residual_currency",
|
||||
"debit",
|
||||
"amount_currency",
|
||||
]
|
||||
|
|
|
@ -60,13 +60,7 @@ class VATReport(models.AbstractModel):
|
|||
tax_domain = self._get_tax_report_domain(
|
||||
company_id, date_from, date_to, only_posted_moves
|
||||
)
|
||||
ml_fields = [
|
||||
"id",
|
||||
"tax_base_amount",
|
||||
"balance",
|
||||
"tax_line_id",
|
||||
"tax_ids",
|
||||
]
|
||||
ml_fields = self._get_ml_fields_vat_report()
|
||||
tax_move_lines = self.env["account.move.line"].search_read(
|
||||
domain=tax_domain,
|
||||
fields=ml_fields,
|
||||
|
@ -234,3 +228,12 @@ class VATReport(models.AbstractModel):
|
|||
"tax_detail": data["tax_detail"],
|
||||
"vat_report": vat_report,
|
||||
}
|
||||
|
||||
def _get_ml_fields_vat_report(self):
|
||||
return [
|
||||
"id",
|
||||
"tax_base_amount",
|
||||
"balance",
|
||||
"tax_line_id",
|
||||
"tax_ids",
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue