[MIG] account_financial_report: Migration to 13.0

This commit is contained in:
Ernesto Tejeda
2020-03-23 11:15:55 -04:00
committed by chaule97
parent 40c874a112
commit 712d4a898a
39 changed files with 789 additions and 1677 deletions

View File

@@ -24,16 +24,14 @@ class AgedPartnerBalanceWizard(models.TransientModel):
[("posted", "All Posted Entries"), ("all", "All Entries")],
string="Target Moves",
required=True,
default="all",
default="posted",
)
account_ids = fields.Many2many(
comodel_name="account.account", string="Filter accounts",
comodel_name="account.account", string="Filter accounts"
)
receivable_accounts_only = fields.Boolean()
payable_accounts_only = fields.Boolean()
partner_ids = fields.Many2many(
comodel_name="res.partner", string="Filter partners",
)
partner_ids = fields.Many2many(comodel_name="res.partner", string="Filter partners")
show_move_line_details = fields.Boolean()
@api.onchange("company_id")
@@ -73,7 +71,6 @@ class AgedPartnerBalanceWizard(models.TransientModel):
domain += [("reconcile", "=", True)]
self.account_ids = self.env["account.account"].search(domain)
@api.multi
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_report_aged_partner_balance()
@@ -90,19 +87,16 @@ class AgedPartnerBalanceWizard(models.TransientModel):
.report_action(self, data=data)
)
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = "qweb-html"
return self._export(report_type)
@api.multi
def button_export_pdf(self):
self.ensure_one()
report_type = "qweb-pdf"
return self._export(report_type)
@api.multi
def button_export_xlsx(self):
self.ensure_one()
report_type = "xlsx"

View File

@@ -73,7 +73,6 @@
id="action_aged_partner_balance_wizard"
name="Aged Partner Balance"
res_model="aged.partner.balance.report.wizard"
view_type="form"
view_mode="form"
view_id="aged_partner_balance_wizard"
target="new"

View File

@@ -34,10 +34,10 @@ class GeneralLedgerReportWizard(models.TransientModel):
[("posted", "All Posted Entries"), ("all", "All Entries")],
string="Target Moves",
required=True,
default="all",
default="posted",
)
account_ids = fields.Many2many(
comodel_name="account.account", string="Filter accounts",
comodel_name="account.account", string="Filter accounts"
)
centralize = fields.Boolean(string="Activate centralization", default=True)
hide_account_at_0 = fields.Boolean(
@@ -47,7 +47,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
"If partners are filtered, "
"debits and credits totals will not match the trial balance.",
)
show_analytic_tags = fields.Boolean(string="Show analytic tags",)
show_analytic_tags = fields.Boolean(string="Show analytic tags")
receivable_accounts_only = fields.Boolean()
payable_accounts_only = fields.Boolean()
partner_ids = fields.Many2many(
@@ -56,13 +56,13 @@ class GeneralLedgerReportWizard(models.TransientModel):
default=lambda self: self._default_partners(),
)
analytic_tag_ids = fields.Many2many(
comodel_name="account.analytic.tag", string="Filter analytic tags",
comodel_name="account.analytic.tag", string="Filter analytic tags"
)
account_journal_ids = fields.Many2many(
comodel_name="account.journal", string="Filter journals",
comodel_name="account.journal", string="Filter journals"
)
cost_center_ids = fields.Many2many(
comodel_name="account.analytic.account", string="Filter cost centers",
comodel_name="account.analytic.account", string="Filter cost centers"
)
not_only_one_unaffected_earnings_account = fields.Boolean(
@@ -79,27 +79,29 @@ class GeneralLedgerReportWizard(models.TransientModel):
def _init_date_from(self):
"""set start date to begin of current year if fiscal year running"""
today = fields.Date.context_today(self)
cur_month = fields.Date.from_string(today).month
cur_day = fields.Date.from_string(today).day
last_fsc_month = self.env.user.company_id.fiscalyear_last_month
last_fsc_day = self.env.user.company_id.fiscalyear_last_day
if (
cur_month < last_fsc_month
or cur_month == last_fsc_month
and cur_day <= last_fsc_day
today.month < int(last_fsc_month)
or today.month == int(last_fsc_month)
and today.day <= last_fsc_day
):
return time.strftime("%Y-01-01")
else:
return False
def _default_foreign_currency(self):
return self.env.user.has_group("base.group_multi_currency")
@api.depends("date_from")
def _compute_fy_start_date(self):
for wiz in self.filtered("date_from"):
date = fields.Datetime.from_string(wiz.date_from)
res = self.company_id.compute_fiscalyear_dates(date)
wiz.fy_start_date = fields.Date.to_string(res["date_from"])
for wiz in self:
if wiz.date_from:
res = self.company_id.compute_fiscalyear_dates(wiz.date_from)
wiz.fy_start_date = res["date_from"]
else:
wiz.fy_start_date = False
@api.onchange("company_id")
def onchange_company_id(self):
@@ -171,7 +173,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end
@api.multi
@api.constrains("company_id", "date_range_id")
def _check_company_id_date_range_id(self):
for rec in self.sudo():
@@ -210,7 +211,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
else:
self.receivable_accounts_only = self.payable_accounts_only = False
@api.multi
@api.depends("company_id")
def _compute_unaffected_earnings_account(self):
account_type = self.env.ref("account.data_unaffected_earnings")
@@ -228,7 +228,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
store=True,
)
@api.multi
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_report_general_ledger()
@@ -245,19 +244,16 @@ class GeneralLedgerReportWizard(models.TransientModel):
.report_action(self, data=data)
)
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = "qweb-html"
return self._export(report_type)
@api.multi
def button_export_pdf(self):
self.ensure_one()
report_type = "qweb-pdf"
return self._export(report_type)
@api.multi
def button_export_xlsx(self):
self.ensure_one()
report_type = "xlsx"

View File

@@ -124,7 +124,6 @@
id="action_general_ledger_wizard"
name="General Ledger"
res_model="general.ledger.report.wizard"
view_type="form"
view_mode="form"
view_id="general_ledger_wizard"
target="new"
@@ -134,14 +133,13 @@
id="act_action_general_ledger_wizard_partner_relation"
name="General Ledger"
res_model="general.ledger.report.wizard"
src_model="res.partner"
binding_model="res.partner"
view_mode="form"
context="{
'default_receivable_accounts_only':1,
'default_payable_accounts_only':1,
}"
groups="account.group_account_manager"
key2="client_action_multi"
target="new"
/>
</odoo>

View File

@@ -17,14 +17,14 @@ class JournalLedgerReportWizard(models.TransientModel):
required=False,
ondelete="cascade",
)
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range",)
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
date_from = fields.Date(string="Start date", required=True)
date_to = fields.Date(string="End date", required=True)
journal_ids = fields.Many2many(
comodel_name="account.journal", string="Journals", required=False,
comodel_name="account.journal", string="Journals", required=False
)
move_target = fields.Selection(
selection="_get_move_targets", default="all", required=True,
selection="_get_move_targets", default="posted", required=True
)
foreign_currency = fields.Boolean()
sort_option = fields.Selection(
@@ -39,7 +39,7 @@ class JournalLedgerReportWizard(models.TransientModel):
default="journal",
required=True,
)
with_account_name = fields.Boolean(default=False,)
with_account_name = fields.Boolean(default=False)
@api.model
def _get_move_targets(self):
@@ -47,17 +47,11 @@ class JournalLedgerReportWizard(models.TransientModel):
@api.model
def _get_sort_options(self):
return [
("move_name", _("Entry number")),
("date", _("Date")),
]
return [("move_name", _("Entry number")), ("date", _("Date"))]
@api.model
def _get_group_options(self):
return [
("journal", _("Journal")),
("none", _("No group")),
]
return [("journal", _("Journal")), ("none", _("No group"))]
@api.onchange("date_range_id")
def onchange_date_range_id(self):
@@ -84,7 +78,6 @@ class JournalLedgerReportWizard(models.TransientModel):
res["domain"]["journal_ids"] += [("company_id", "=", self.company_id.id)]
return res
@api.multi
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_report_journal_ledger()
@@ -101,24 +94,20 @@ class JournalLedgerReportWizard(models.TransientModel):
.report_action(self, data=data)
)
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = "qweb-html"
return self._export(report_type)
@api.multi
def button_export_pdf(self):
report_type = "qweb-pdf"
return self._export(report_type)
@api.multi
def button_export_xlsx(self):
self.ensure_one()
report_type = "xlsx"
return self._export(report_type)
@api.multi
def _prepare_report_journal_ledger(self):
self.ensure_one()
journals = self.journal_ids

View File

@@ -68,7 +68,6 @@
id="action_journal_ledger_wizard"
name="Journal Ledger"
res_model="journal.ledger.report.wizard"
view_type="form"
view_mode="form"
view_id="journal_ledger_wizard"
target="new"

View File

@@ -25,7 +25,7 @@ class OpenItemsReportWizard(models.TransientModel):
[("posted", "All Posted Entries"), ("all", "All Entries")],
string="Target Moves",
required=True,
default="all",
default="posted",
)
account_ids = fields.Many2many(
comodel_name="account.account",
@@ -95,7 +95,6 @@ class OpenItemsReportWizard(models.TransientModel):
domain += [("reconcile", "=", True)]
self.account_ids = self.env["account.account"].search(domain)
@api.multi
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_report_open_items()
@@ -112,19 +111,16 @@ class OpenItemsReportWizard(models.TransientModel):
.report_action(self, data=data)
)
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = "qweb-html"
return self._export(report_type)
@api.multi
def button_export_pdf(self):
self.ensure_one()
report_type = "qweb-pdf"
return self._export(report_type)
@api.multi
def button_export_xlsx(self):
self.ensure_one()
report_type = "xlsx"

View File

@@ -74,7 +74,6 @@
id="action_open_items_wizard"
name="Open Items"
res_model="open.items.report.wizard"
view_type="form"
view_mode="form"
view_id="open_items_wizard"
target="new"
@@ -84,14 +83,13 @@
id="act_action_open_items_wizard_partner_relation"
name="Open Items Partner"
res_model="open.items.report.wizard"
src_model="res.partner"
binding_model="res.partner"
view_mode="form"
context="{
'default_receivable_accounts_only':1,
'default_payable_accounts_only':1,
}"
groups="account.group_account_manager"
key2="client_action_multi"
target="new"
/>
</odoo>

View File

@@ -29,7 +29,7 @@ class TrialBalanceReportWizard(models.TransientModel):
[("posted", "All Posted Entries"), ("all", "All Entries")],
string="Target Moves",
required=True,
default="all",
default="posted",
)
hierarchy_on = fields.Selection(
[
@@ -52,7 +52,7 @@ class TrialBalanceReportWizard(models.TransientModel):
"Do not display parent levels", default=False
)
account_ids = fields.Many2many(
comodel_name="account.account", string="Filter accounts",
comodel_name="account.account", string="Filter accounts"
)
hide_account_at_0 = fields.Boolean(
string="Hide accounts at 0",
@@ -64,10 +64,8 @@ class TrialBalanceReportWizard(models.TransientModel):
receivable_accounts_only = fields.Boolean()
payable_accounts_only = fields.Boolean()
show_partner_details = fields.Boolean()
partner_ids = fields.Many2many(
comodel_name="res.partner", string="Filter partners",
)
journal_ids = fields.Many2many(comodel_name="account.journal",)
partner_ids = fields.Many2many(comodel_name="res.partner", string="Filter partners")
journal_ids = fields.Many2many(comodel_name="account.journal")
not_only_one_unaffected_earnings_account = fields.Boolean(
readonly=True, string="Not only one unaffected earnings account"
@@ -80,7 +78,6 @@ class TrialBalanceReportWizard(models.TransientModel):
"will display initial and final balance in that currency.",
)
@api.multi
@api.constrains("hierarchy_on", "show_hierarchy_level")
def _check_show_hierarchy_level(self):
for rec in self:
@@ -91,10 +88,12 @@ class TrialBalanceReportWizard(models.TransientModel):
@api.depends("date_from")
def _compute_fy_start_date(self):
for wiz in self.filtered("date_from"):
date = fields.Datetime.from_string(wiz.date_from)
res = self.company_id.compute_fiscalyear_dates(date)
wiz.fy_start_date = fields.Date.to_string(res["date_from"])
for wiz in self:
if wiz.date_from:
res = self.company_id.compute_fiscalyear_dates(wiz.date_from)
wiz.fy_start_date = res["date_from"]
else:
wiz.fy_start_date = False
@api.onchange("company_id")
def onchange_company_id(self):
@@ -155,7 +154,6 @@ class TrialBalanceReportWizard(models.TransientModel):
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end
@api.multi
@api.constrains("company_id", "date_range_id")
def _check_company_id_date_range_id(self):
for rec in self.sudo():
@@ -194,7 +192,6 @@ class TrialBalanceReportWizard(models.TransientModel):
else:
self.receivable_accounts_only = self.payable_accounts_only = False
@api.multi
@api.depends("company_id")
def _compute_unaffected_earnings_account(self):
account_type = self.env.ref("account.data_unaffected_earnings")
@@ -212,7 +209,6 @@ class TrialBalanceReportWizard(models.TransientModel):
store=True,
)
@api.multi
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_report_trial_balance()
@@ -229,19 +225,16 @@ class TrialBalanceReportWizard(models.TransientModel):
.report_action(self, data=data)
)
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = "qweb-html"
return self._export(report_type)
@api.multi
def button_export_pdf(self):
self.ensure_one()
report_type = "qweb-pdf"
return self._export(report_type)
@api.multi
def button_export_xlsx(self):
self.ensure_one()
report_type = "xlsx"

View File

@@ -133,7 +133,6 @@
id="action_trial_balance_wizard"
name="Trial Balance"
res_model="trial.balance.report.wizard"
view_type="form"
view_mode="form"
view_id="trial_balance_wizard"
target="new"

View File

@@ -34,7 +34,7 @@ class VATReportWizard(models.TransientModel):
and self.date_range_id.company_id != self.company_id
):
self.date_range_id = False
res = {"domain": {"date_range_id": [],}}
res = {"domain": {"date_range_id": []}}
if not self.company_id:
return res
else:
@@ -51,7 +51,6 @@ class VATReportWizard(models.TransientModel):
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end
@api.multi
@api.constrains("company_id", "date_range_id")
def _check_company_id_date_range_id(self):
for rec in self.sudo():
@@ -67,7 +66,6 @@ class VATReportWizard(models.TransientModel):
)
)
@api.multi
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_vat_report()
@@ -84,19 +82,16 @@ class VATReportWizard(models.TransientModel):
.report_action(self, data=data)
)
@api.multi
def button_export_html(self):
self.ensure_one()
report_type = "qweb-html"
return self._export(report_type)
@api.multi
def button_export_pdf(self):
self.ensure_one()
report_type = "qweb-pdf"
return self._export(report_type)
@api.multi
def button_export_xlsx(self):
self.ensure_one()
report_type = "xlsx"

View File

@@ -53,7 +53,6 @@
id="action_vat_report_wizard"
name="VAT Report"
res_model="vat.report.wizard"
view_type="form"
view_mode="form"
view_id="vat_report_wizard"
target="new"