Browse Source

[MIG] account_financial_report to 13.0

pull/744/head
Tom Blauwendraat 4 years ago
parent
commit
b636a9ec2d
  1. 6
      account_financial_report/__manifest__.py
  2. 2
      account_financial_report/models/account_group.py
  3. 3
      account_financial_report/models/account_move_line.py
  4. 6
      account_financial_report/readme/CONTRIBUTORS.rst
  5. 2
      account_financial_report/readme/DESCRIPTION.rst
  6. 8
      account_financial_report/readme/ROADMAP.rst
  7. 7
      account_financial_report/report/abstract_report_xlsx.py
  8. 2
      account_financial_report/report/aged_partner_balance.py
  9. 1
      account_financial_report/report/aged_partner_balance_xlsx.py
  10. 3
      account_financial_report/report/general_ledger.py
  11. 1
      account_financial_report/report/general_ledger_xlsx.py
  12. 16
      account_financial_report/report/journal_ledger.py
  13. 1
      account_financial_report/report/journal_ledger_xlsx.py
  14. 3
      account_financial_report/report/open_items.py
  15. 1
      account_financial_report/report/open_items_xlsx.py
  16. 3
      account_financial_report/report/trial_balance.py
  17. 1
      account_financial_report/report/trial_balance_xlsx.py
  18. 3
      account_financial_report/report/vat_report.py
  19. 1
      account_financial_report/report/vat_report_xlsx.py
  20. 8
      account_financial_report/static/src/js/account_financial_report_backend.js
  21. 2
      account_financial_report/tests/test_vat_report.py
  22. 7
      account_financial_report/wizard/aged_partner_balance_wizard.py
  23. 1
      account_financial_report/wizard/aged_partner_balance_wizard_view.xml
  24. 32
      account_financial_report/wizard/general_ledger_wizard.py
  25. 4
      account_financial_report/wizard/general_ledger_wizard_view.xml
  26. 6
      account_financial_report/wizard/journal_ledger_wizard.py
  27. 1
      account_financial_report/wizard/journal_ledger_wizard_view.xml
  28. 7
      account_financial_report/wizard/open_items_wizard.py
  29. 4
      account_financial_report/wizard/open_items_wizard_view.xml
  30. 19
      account_financial_report/wizard/trial_balance_wizard.py
  31. 1
      account_financial_report/wizard/trial_balance_wizard_view.xml
  32. 6
      account_financial_report/wizard/vat_report_wizard.py
  33. 1
      account_financial_report/wizard/vat_report_wizard_view.xml

6
account_financial_report/__manifest__.py

@ -4,16 +4,16 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Financial Reports",
"version": "12.0.1.4.1",
"version": "13.0.2.0.0",
"category": "Reporting",
"summary": "OCA Financial Reports",
"author": "Camptocamp SA,"
"initOS GmbH,"
"redCOR AG,"
"Eficent,"
"ForgeFlow,"
"Odoo Community Association (OCA)",
"website": "https://odoo-community.org/",
"depends": ["account", "date_range", "report_xlsx",],
"depends": ["account", "date_range", "report_xlsx"],
"data": [
"wizard/aged_partner_balance_wizard_view.xml",
"wizard/general_ledger_wizard_view.xml",

2
account_financial_report/models/account_group.py

@ -21,7 +21,6 @@ class AccountGroup(models.Model):
store=True,
)
@api.multi
@api.depends("parent_id", "parent_id.level")
def _compute_level(self):
for group in self:
@ -30,7 +29,6 @@ class AccountGroup(models.Model):
else:
group.level = group.parent_id.level + 1
@api.multi
@api.depends(
"code_prefix",
"account_ids",

3
account_financial_report/models/account_move_line.py

@ -1,12 +1,11 @@
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from odoo import api, models
from odoo import models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
@api.model_cr
def init(self):
"""
The join between accounts_partners subquery and account_move_line

6
account_financial_report/readme/CONTRIBUTORS.rst

@ -1,4 +1,4 @@
* Jordi Ballester <jordi.ballester@eficient.com>
* Jordi Ballester <jordi.ballester@forgeflow.com>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Simone Orsi <simone.orsi@abstract.com>
* Leonardo Pistone <leonardo.pistone@camptocamp.com>
@ -19,9 +19,13 @@
* Pedro M. Baeza
* Sergio Teruel
* Ernesto Tejeda
* `Druidoo <https://www.druidoo.io>`__:
* Iván Todorovich
* Tom Blauwendraat <tom@sunflowerweb.nl>
Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.

2
account_financial_report/readme/DESCRIPTION.rst

@ -1,5 +1,5 @@
This module adds a set of financial reports. They are accessible under
Accounting / Reporting / OCA Reports.
Invoicing / Reporting / OCA accounting reports.
- General ledger
- Trial Balance

8
account_financial_report/readme/ROADMAP.rst

@ -0,0 +1,8 @@
* 'VAT Report' is valid only for cases where it's met that for each
Tax defined: all the "Account tags" of all the
'Repartition for Invoices' or 'Repartition for Credit Notes'
are different.
* It would be nice to have in reports a column indicating the
state of the entries when the option "All Entries" is selected
in "Target Moves" field in a wizard

7
account_financial_report/report/abstract_report_xlsx.py

@ -9,6 +9,7 @@ from odoo.tools import format_date
class AbstractReportXslx(models.AbstractModel):
_name = "report.account_financial_report.abstract_report_xlsx"
_description = "Abstract XLSX Account Financial Report"
_inherit = "report.report_xlsx.abstract"
def __init__(self, pool, cr):
@ -328,10 +329,10 @@ class AbstractReportXslx(models.AbstractModel):
def _get_currency_amt_format(self, line_object):
""" Return amount format specific for each currency. """
if hasattr(line_object, "account_group_id") and line_object.account_group_id:
format_amt = getattr(self, "format_amount_bold")
format_amt = self.format_amount_bold
field_prefix = "format_amount_bold"
else:
format_amt = getattr(self, "format_amount")
format_amt = self.format_amount
field_prefix = "format_amount"
if line_object.currency_id:
field_name = "{}_{}".format(field_prefix, line_object.currency_id.name)
@ -339,7 +340,7 @@ class AbstractReportXslx(models.AbstractModel):
format_amt = getattr(self, field_name)
else:
format_amt = self.workbook.add_format()
setattr(self, "field_name", format_amt)
self.field_name = format_amt
format_amount = "#,##0." + (
"0" * line_object.currency_id.decimal_places
)

2
account_financial_report/report/aged_partner_balance.py

@ -175,7 +175,6 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
_inherit = "report_aged_partner_balance"
@api.multi
def print_report(self, report_type):
self.ensure_one()
if report_type == "xlsx":
@ -214,7 +213,6 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
"filter_partner_ids": [(6, 0, self.filter_partner_ids.ids)],
}
@api.multi
def compute_data_for_report(self):
self.ensure_one()
# Compute Open Items Report Data.

1
account_financial_report/report/aged_partner_balance_xlsx.py

@ -7,6 +7,7 @@ from odoo import _, models
class AgedPartnerBalanceXslx(models.AbstractModel):
_name = "report.a_f_r.report_aged_partner_balance_xlsx"
_description = "Aged Partner Balance XLSX Report"
_inherit = "report.account_financial_report.abstract_report_xlsx"
def _get_report_name(self, report):

3
account_financial_report/report/general_ledger.py

@ -21,6 +21,7 @@ class GeneralLedgerReport(models.TransientModel):
"""
_name = "report_general_ledger"
_description = "General Ledger Report"
_inherit = "account_financial_report_abstract"
# Filters fields, used for data computation
@ -194,7 +195,6 @@ class GeneralLedgerReportCompute(models.TransientModel):
_inherit = "report_general_ledger"
@api.multi
def print_report(self, report_type):
self.ensure_one()
if report_type == "xlsx":
@ -226,7 +226,6 @@ class GeneralLedgerReportCompute(models.TransientModel):
def get_html(self, given_context=None):
return self._get_html()
@api.multi
def compute_data_for_report(self, with_line_details=True, with_partners=True):
self.ensure_one()
# Compute report data

1
account_financial_report/report/general_ledger_xlsx.py

@ -8,6 +8,7 @@ from odoo import _, models
class GeneralLedgerXslx(models.AbstractModel):
_name = "report.a_f_r.report_general_ledger_xlsx"
_description = "General Ledger XLSX Report"
_inherit = "report.account_financial_report.abstract_report_xlsx"
def _get_report_name(self, report):

16
account_financial_report/report/journal_ledger.py

@ -9,6 +9,7 @@ DIGITS = (16, 2)
class ReportJournalLedger(models.TransientModel):
_name = "report_journal_ledger"
_description = "Journal Ledger Report"
_inherit = "account_financial_report_abstract"
date_from = fields.Date(required=True)
@ -56,7 +57,6 @@ class ReportJournalLedger(models.TransientModel):
def _get_group_options(self):
return self.env["journal.ledger.report.wizard"]._get_group_options()
@api.multi
def compute_data_for_report(self):
self.ensure_one()
self._inject_journal_values()
@ -71,7 +71,6 @@ class ReportJournalLedger(models.TransientModel):
# Refresh cache because all data are computed with SQL requests
self.invalidate_cache()
@api.multi
def _inject_journal_values(self):
self.ensure_one()
sql = """
@ -120,7 +119,6 @@ class ReportJournalLedger(models.TransientModel):
)
self.env.cr.execute(sql, params)
@api.multi
def _inject_move_values(self):
self.ensure_one()
sql = """
@ -137,7 +135,6 @@ class ReportJournalLedger(models.TransientModel):
params = self._get_inject_move_params()
self.env.cr.execute(sql, params)
@api.multi
def _get_inject_move_insert(self):
return """
INSERT INTO report_journal_ledger_move (
@ -151,7 +148,6 @@ class ReportJournalLedger(models.TransientModel):
)
"""
@api.multi
def _get_inject_move_select(self):
return """
SELECT
@ -169,7 +165,6 @@ class ReportJournalLedger(models.TransientModel):
on (rjqj.journal_id = am.journal_id)
"""
@api.multi
def _get_inject_move_where_clause(self):
self.ensure_one()
where_clause = """
@ -187,7 +182,6 @@ class ReportJournalLedger(models.TransientModel):
"""
return where_clause
@api.multi
def _get_inject_move_order_by(self):
self.ensure_one()
order_by = """
@ -199,7 +193,6 @@ class ReportJournalLedger(models.TransientModel):
order_by += " am.date, am.name"
return order_by
@api.multi
def _get_inject_move_params(self):
params = [self.env.uid, self.id, self.date_from, self.date_to]
@ -208,7 +201,6 @@ class ReportJournalLedger(models.TransientModel):
return tuple(params)
@api.multi
def _inject_move_line_values(self):
self.ensure_one()
sql = """
@ -316,7 +308,6 @@ class ReportJournalLedger(models.TransientModel):
)
self.env.cr.execute(sql, params)
@api.multi
def _inject_report_tax_values(self):
self.ensure_one()
sql_distinct_tax_id = """
@ -404,7 +395,6 @@ class ReportJournalLedger(models.TransientModel):
)
self.env.cr.execute(sql, params)
@api.multi
def _inject_journal_tax_values(self):
self.ensure_one()
sql = """
@ -529,7 +519,6 @@ class ReportJournalLedger(models.TransientModel):
)
self.env.cr.execute(sql, params)
@api.multi
def _update_journal_report_total_values(self):
self.ensure_one()
sql = """
@ -551,7 +540,6 @@ class ReportJournalLedger(models.TransientModel):
"""
self.env.cr.execute(sql, (self.id,))
@api.multi
def print_report(self, report_type):
self.ensure_one()
if report_type == "xlsx":
@ -708,12 +696,10 @@ class ReportJournalLedgerReportTaxLine(models.TransientModel):
tax_credit = fields.Float(digits=DIGITS,)
tax_balance = fields.Float(digits=DIGITS, compute="_compute_tax_balance")
@api.multi
def _compute_base_balance(self):
for rec in self:
rec.base_balance = rec.base_debit - rec.base_credit
@api.multi
def _compute_tax_balance(self):
for rec in self:
rec.tax_balance = rec.tax_debit - rec.tax_credit

1
account_financial_report/report/journal_ledger_xlsx.py

@ -8,6 +8,7 @@ from odoo import _, models
class JournalLedgerXslx(models.AbstractModel):
_name = "report.a_f_r.report_journal_ledger_xlsx"
_description = "Journal Ledger Report XLSX"
_inherit = "report.account_financial_report.abstract_report_xlsx"
def _get_report_name(self, report):

3
account_financial_report/report/open_items.py

@ -16,6 +16,7 @@ class OpenItemsReport(models.TransientModel):
"""
_name = "report_open_items"
_description = "Open Items Report"
_inherit = "account_financial_report_abstract"
# Filters fields, used for data computation
@ -134,7 +135,6 @@ class OpenItemsReportCompute(models.TransientModel):
_inherit = "report_open_items"
@api.multi
def print_report(self, report_type):
self.ensure_one()
if report_type == "xlsx":
@ -166,7 +166,6 @@ class OpenItemsReportCompute(models.TransientModel):
def get_html(self, given_context=None):
return self._get_html()
@api.multi
def compute_data_for_report(self):
self.ensure_one()
# Compute report data

1
account_financial_report/report/open_items_xlsx.py

@ -7,6 +7,7 @@ from odoo import _, models
class OpenItemsXslx(models.AbstractModel):
_name = "report.a_f_r.report_open_items_xlsx"
_description = "Open Items Report XLSX"
_inherit = "report.account_financial_report.abstract_report_xlsx"
def _get_report_name(self, report):

3
account_financial_report/report/trial_balance.py

@ -18,6 +18,7 @@ class TrialBalanceReport(models.TransientModel):
"""
_name = "report_trial_balance"
_description = "Trial Balance Report"
_inherit = "account_financial_report_abstract"
# Filters fields, used for data computation
@ -185,7 +186,6 @@ class TrialBalanceReportCompute(models.TransientModel):
_inherit = "report_trial_balance"
@api.multi
def print_report(self, report_type):
self.ensure_one()
if report_type == "xlsx":
@ -233,7 +233,6 @@ class TrialBalanceReportCompute(models.TransientModel):
"fy_start_date": self.fy_start_date,
}
@api.multi
def compute_data_for_report(self):
self.ensure_one()
# Compute General Ledger Report Data.

1
account_financial_report/report/trial_balance_xlsx.py

@ -8,6 +8,7 @@ from odoo import _, models
class TrialBalanceXslx(models.AbstractModel):
_name = "report.a_f_r.report_trial_balance_xlsx"
_description = "Trial Balance Report XLSX"
_inherit = "report.account_financial_report.abstract_report_xlsx"
def _get_report_name(self, report):

3
account_financial_report/report/vat_report.py

@ -6,6 +6,7 @@ from odoo import api, fields, models
class VATReport(models.TransientModel):
_name = "report_vat_report"
_description = "VAT Report"
_inherit = "account_financial_report_abstract"
""" Here, we just define class fields.
For methods, go more bottom at this file.
@ -87,7 +88,6 @@ class VATReportCompute(models.TransientModel):
_inherit = "report_vat_report"
@api.multi
def print_report(self, report_type="qweb"):
self.ensure_one()
if report_type == "xlsx":
@ -117,7 +117,6 @@ class VATReportCompute(models.TransientModel):
def get_html(self, given_context=None):
return self.with_context(given_context)._get_html()
@api.multi
def compute_data_for_report(self):
self.ensure_one()
# Compute report data

1
account_financial_report/report/vat_report_xlsx.py

@ -6,6 +6,7 @@ from odoo import _, models
class VATReportXslx(models.AbstractModel):
_name = "report.a_f_r.report_vat_report_xlsx"
_description = "VAT Report XLSX"
_inherit = "report.account_financial_report.abstract_report_xlsx"
def _get_report_name(self, report):

8
account_financial_report/static/src/js/account_financial_report_backend.js

@ -29,11 +29,11 @@ odoo.define("account_financial_report.account_financial_report_backend", functio
return this._super.apply(this, arguments);
},
willStart: function() {
return $.when(this.get_html());
return Promise.resolve(this.get_html());
},
set_html: function() {
var self = this;
var def = $.when();
var def = Promise.resolve();
if (!this.report_widget) {
this.report_widget = new ReportWidget(this, this.given_context);
def = this.report_widget.appendTo(this.$el);
@ -59,7 +59,7 @@ odoo.define("account_financial_report.account_financial_report_backend", functio
}).then(function(result) {
self.html = result.html;
defs.push(self.update_cp());
return $.when.apply($, defs);
return Promise.resolve.apply(Promise, defs);
});
},
// Updates the control panel and render the elements that have yet
@ -100,7 +100,7 @@ odoo.define("account_financial_report.account_financial_report_backend", functio
});
},
canBeRemoved: function() {
return $.when();
return Promise.resolve();
},
});

2
account_financial_report/tests/test_vat_report.py

@ -33,7 +33,7 @@ class TestVAT(abstract_test_tax_report.AbstractTest):
return {
"date_from": date(date.today().year, 1, 1),
"date_to": date(date.today().year, 12, 31),
"company_id": self.env.user.company_id.id,
"company_id": self.env.company.id,
}
def _getAdditionalFiltersToBeTested(self):

7
account_financial_report/wizard/aged_partner_balance_wizard.py

@ -17,7 +17,7 @@ class AgedPartnerBalanceWizard(models.TransientModel):
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
default=lambda self: self.env.company,
required=False,
string="Company",
)
@ -26,7 +26,7 @@ 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",
@ -75,7 +75,6 @@ class AgedPartnerBalanceWizard(models.TransientModel):
else:
self.account_ids = None
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref(
@ -94,13 +93,11 @@ class AgedPartnerBalanceWizard(models.TransientModel):
vals["context"] = context1
return vals
@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"

1
account_financial_report/wizard/aged_partner_balance_wizard_view.xml

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

32
account_financial_report/wizard/general_ledger_wizard.py

@ -25,7 +25,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
default=lambda self: self.env.company,
required=False,
string="Company",
)
@ -37,7 +37,7 @@ 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",
@ -85,27 +85,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
last_fsc_month = self.env.company.fiscalyear_last_month
last_fsc_day = self.env.company.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):
@ -177,7 +179,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():
@ -217,7 +218,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
# Somehow this is required to force onchange on _default_partners()
self._onchange_account_type_ids()
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref("account_financial_report.action_report_general_ledger")
@ -233,13 +233,11 @@ class GeneralLedgerReportWizard(models.TransientModel):
action_data["context"] = context1
return action_data
@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"

4
account_financial_report/wizard/general_ledger_wizard_view.xml

@ -172,7 +172,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"
@ -182,10 +181,9 @@
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"
groups="account.group_account_manager"
key2="client_action_multi"
target="new"
/>
</odoo>

6
account_financial_report/wizard/journal_ledger_wizard.py

@ -14,7 +14,7 @@ class JournalLedgerReportWizard(models.TransientModel):
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
default=lambda self: self.env.company,
string="Company",
required=False,
ondelete="cascade",
@ -86,7 +86,6 @@ class JournalLedgerReportWizard(models.TransientModel):
res["domain"]["journal_ids"] += [("company_id", "=", self.company_id.id)]
return res
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref("account_financial_report.action_report_journal_ledger")
@ -102,19 +101,16 @@ class JournalLedgerReportWizard(models.TransientModel):
vals["context"] = context1
return vals
@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"
return self._export(report_type)
@api.multi
def _prepare_report_journal_ledger(self):
self.ensure_one()
journals = self.journal_ids

1
account_financial_report/wizard/journal_ledger_wizard_view.xml

@ -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"

7
account_financial_report/wizard/open_items_wizard.py

@ -17,7 +17,7 @@ class OpenItemsReportWizard(models.TransientModel):
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
default=lambda self: self.env.company,
required=False,
string="Company",
)
@ -26,7 +26,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",
@ -96,7 +96,6 @@ class OpenItemsReportWizard(models.TransientModel):
else:
self.account_ids = None
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref("account_financial_report.action_report_open_items")
@ -113,13 +112,11 @@ class OpenItemsReportWizard(models.TransientModel):
vals["context"] = context1
return vals
@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"

4
account_financial_report/wizard/open_items_wizard_view.xml

@ -73,7 +73,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"
@ -83,14 +82,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>

19
account_financial_report/wizard/trial_balance_wizard.py

@ -19,7 +19,7 @@ class TrialBalanceReportWizard(models.TransientModel):
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
default=lambda self: self.env.company,
required=False,
string="Company",
)
@ -31,7 +31,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(
[
@ -82,7 +82,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:
@ -93,10 +92,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):
@ -157,7 +158,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():
@ -196,7 +196,6 @@ class TrialBalanceReportWizard(models.TransientModel):
else:
self.receivable_accounts_only = self.payable_accounts_only = False
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref("account_financial_report.action_report_trial_balance")
@ -213,13 +212,11 @@ class TrialBalanceReportWizard(models.TransientModel):
vals["context"] = context1
return vals
@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"

1
account_financial_report/wizard/trial_balance_wizard_view.xml

@ -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"

6
account_financial_report/wizard/vat_report_wizard.py

@ -13,7 +13,7 @@ class VATReportWizard(models.TransientModel):
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
default=lambda self: self.env.company,
required=False,
string="Company",
)
@ -53,7 +53,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():
@ -69,7 +68,6 @@ class VATReportWizard(models.TransientModel):
)
)
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref("account_financial_report.action_report_vat_report")
@ -85,13 +83,11 @@ class VATReportWizard(models.TransientModel):
vals["context"] = context1
return vals
@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"

1
account_financial_report/wizard/vat_report_wizard_view.xml

@ -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"

Loading…
Cancel
Save