[MIG] account_financial_report: Migration to 13.0
parent
f21b543450
commit
2d7d0617c2
|
@ -14,19 +14,19 @@ Account Financial Reports
|
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/account-financial-reporting/tree/12.0/account_financial_report
|
||||
:target: https://github.com/OCA/account-financial-reporting/tree/13.0/account_financial_report
|
||||
:alt: OCA/account-financial-reporting
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/account-financial-reporting-12-0/account-financial-reporting-12-0-account_financial_report
|
||||
:target: https://translation.odoo-community.org/projects/account-financial-reporting-13-0/account-financial-reporting-13-0-account_financial_report
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/91/12.0
|
||||
:target: https://runbot.odoo-community.org/runbot/91/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
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
|
||||
|
@ -47,6 +47,17 @@ currency balances are not available.
|
|||
.. contents::
|
||||
:local:
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* '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
|
||||
|
||||
Changelog
|
||||
=========
|
||||
|
||||
|
@ -76,7 +87,7 @@ Bug Tracker
|
|||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-reporting/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_financial_report%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_financial_report%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
|
@ -89,12 +100,12 @@ Authors
|
|||
* Camptocamp SA
|
||||
* initOS GmbH
|
||||
* redCOR AG
|
||||
* Eficent
|
||||
* ForgeFlow
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* 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>
|
||||
|
@ -110,11 +121,13 @@ Contributors
|
|||
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||
* Alexis de Lattre <alexis@via.ecp.fr>
|
||||
* Mihai Fekete <feketemihai@gmail.com>
|
||||
* Miquel Raïch <miquel.raich@eficent.com>
|
||||
* Miquel Raïch <miquel.raich@forgeflow.com>
|
||||
* Joan Sisquella <joan.sisquella@forgeflow.com>
|
||||
* `Tecnativa <https://www.tecnativa.com>`__:
|
||||
|
||||
* Pedro M. Baeza
|
||||
* Sergio Teruel
|
||||
* Ernesto Tejeda
|
||||
|
||||
Much of the work in this module was done at a sprint in Sorrento, Italy in
|
||||
April 2016.
|
||||
|
@ -132,6 +145,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/12.0/account_financial_report>`_ project on GitHub.
|
||||
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/13.0/account_financial_report>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Account Financial Reports",
|
||||
"version": "12.0.2.0.0",
|
||||
"version": "13.0.1.0.0",
|
||||
"category": "Reporting",
|
||||
"summary": "OCA Financial Reports",
|
||||
"author": "Camptocamp SA,"
|
||||
|
@ -14,7 +14,7 @@
|
|||
"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",
|
||||
|
@ -40,7 +40,6 @@
|
|||
"view/report_aged_partner_balance.xml",
|
||||
"view/report_vat_report.xml",
|
||||
],
|
||||
"external_dependencies": {"python": ["natsort", "pandas",],},
|
||||
"installable": True,
|
||||
"application": True,
|
||||
"auto_install": False,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,13 +36,11 @@ class AccountGroup(models.Model):
|
|||
""" Forms complete code of location from parent location to child location. """
|
||||
if self.parent_id.complete_code:
|
||||
self.complete_code = "{}/{}".format(
|
||||
self.parent_id.complete_code,
|
||||
self.code_prefix,
|
||||
self.parent_id.complete_code, self.code_prefix
|
||||
)
|
||||
else:
|
||||
self.complete_code = self.code_prefix
|
||||
|
||||
@api.multi
|
||||
@api.depends("parent_id", "parent_id.level")
|
||||
def _compute_level(self):
|
||||
for group in self:
|
||||
|
@ -51,7 +49,6 @@ class AccountGroup(models.Model):
|
|||
else:
|
||||
group.level = group.parent_id.level + 1
|
||||
|
||||
@api.multi
|
||||
@api.depends(
|
||||
"code_prefix",
|
||||
"account_ids",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
* Pedro M. Baeza
|
||||
* Sergio Teruel
|
||||
* Ernesto Tejeda
|
||||
|
||||
Much of the work in this module was done at a sprint in Sorrento, Italy in
|
||||
April 2016.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
* '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
|
|
@ -6,6 +6,7 @@ from odoo import models
|
|||
|
||||
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):
|
||||
|
@ -255,7 +256,7 @@ class AbstractReportXslx(models.AbstractModel):
|
|||
and not isinstance(value, bool)
|
||||
and not isinstance(value, int)
|
||||
):
|
||||
value = value.strftime("%d/%m/%Y")
|
||||
value = value and value.strftime("%d/%m/%Y")
|
||||
self.sheet.write_string(self.row_pos, col_pos, value or "")
|
||||
elif cell_type == "amount":
|
||||
if (
|
||||
|
@ -444,10 +445,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)
|
||||
|
@ -455,7 +456,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
|
||||
)
|
||||
|
@ -465,10 +466,10 @@ class AbstractReportXslx(models.AbstractModel):
|
|||
def _get_currency_amt_format_dict(self, line_dict):
|
||||
""" Return amount format specific for each currency. """
|
||||
if line_dict.get("account_group_id", False) and line_dict["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_dict.get("currency_id", False) and line_dict["currency_id"]:
|
||||
currency = self.env["res.currency"].browse([line_dict["currency_id"]])
|
||||
|
@ -477,14 +478,14 @@ 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" * currency.decimal_places)
|
||||
format_amt.set_num_format(format_amount)
|
||||
return format_amt
|
||||
|
||||
def _get_currency_amt_header_format(self, line_object):
|
||||
""" Return amount header format for each currency. """
|
||||
format_amt = getattr(self, "format_header_amount")
|
||||
format_amt = self.format_header_amount
|
||||
if line_object.currency_id:
|
||||
field_name = "format_header_amount_%s" % line_object.currency_id.name
|
||||
if hasattr(self, field_name):
|
||||
|
@ -493,7 +494,7 @@ class AbstractReportXslx(models.AbstractModel):
|
|||
format_amt = self.workbook.add_format(
|
||||
{"bold": True, "border": True, "bg_color": "#FFFFCC"}
|
||||
)
|
||||
setattr(self, "field_name", format_amt)
|
||||
self.field_name = format_amt
|
||||
format_amount = "#,##0." + (
|
||||
"0" * line_object.currency_id.decimal_places
|
||||
)
|
||||
|
@ -502,7 +503,7 @@ class AbstractReportXslx(models.AbstractModel):
|
|||
|
||||
def _get_currency_amt_header_format_dict(self, line_object):
|
||||
""" Return amount header format for each currency. """
|
||||
format_amt = getattr(self, "format_header_amount")
|
||||
format_amt = self.format_header_amount
|
||||
if line_object["currency_id"]:
|
||||
field_name = "format_header_amount_%s" % line_object["currency_name"]
|
||||
if hasattr(self, field_name):
|
||||
|
@ -511,7 +512,7 @@ class AbstractReportXslx(models.AbstractModel):
|
|||
format_amt = self.workbook.add_format(
|
||||
{"bold": True, "border": True, "bg_color": "#FFFFCC"}
|
||||
)
|
||||
setattr(self, "field_name", format_amt)
|
||||
self.field_name = format_amt
|
||||
format_amount = "#,##0." + (
|
||||
"0" * line_object["currency_id"].decimal_places
|
||||
)
|
||||
|
@ -527,8 +528,7 @@ class AbstractReportXslx(models.AbstractModel):
|
|||
def _get_report_complete_name(self, report, prefix, data=None):
|
||||
if report.company_id:
|
||||
suffix = " - {} - {}".format(
|
||||
report.company_id.name,
|
||||
report.company_id.currency_id.name,
|
||||
report.company_id.name, report.company_id.currency_id.name
|
||||
)
|
||||
return prefix + suffix
|
||||
return prefix
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
|
||||
from datetime import date, datetime, timedelta
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from odoo import api, models
|
||||
from odoo.tools import float_is_zero
|
||||
|
||||
|
||||
class AgedPartnerBalanceReport(models.AbstractModel):
|
||||
_name = "report.account_financial_report.aged_partner_balance"
|
||||
_description = "Aged Partner Balance Report"
|
||||
|
||||
@api.model
|
||||
def _initialize_account(self, ag_pb_data, acc_id):
|
||||
|
@ -122,7 +121,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
credit_amount[credit_move_id] = 0.0
|
||||
credit_amount[credit_move_id] += account_partial_reconcile_data["amount"]
|
||||
account_partial_reconcile_data.update(
|
||||
{"debit_move_id": debit_move_id, "credit_move_id": credit_move_id,}
|
||||
{"debit_move_id": debit_move_id, "credit_move_id": credit_move_id}
|
||||
)
|
||||
return accounts_partial_reconcile, debit_amount, credit_amount
|
||||
|
||||
|
@ -215,7 +214,6 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
move_lines = self.env["account.move.line"].search_read(
|
||||
domain=domain, fields=ml_fields
|
||||
)
|
||||
ml_ids = set(pd.DataFrame(move_lines).id.to_list())
|
||||
journals_ids = set()
|
||||
partners_ids = set()
|
||||
partners_data = {}
|
||||
|
@ -227,9 +225,9 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
credit_amount,
|
||||
) = self._get_account_partial_reconciled(company_id, date_at_object)
|
||||
if acc_partial_rec:
|
||||
acc_partial_rec_data = pd.DataFrame(acc_partial_rec)
|
||||
debit_ids = set(acc_partial_rec_data.debit_move_id.to_list())
|
||||
credit_ids = set(acc_partial_rec_data.credit_move_id.to_list())
|
||||
ml_ids = map(lambda r: r["id"], move_lines)
|
||||
debit_ids = map(lambda r: r["debit_move_id"], acc_partial_rec)
|
||||
credit_ids = map(lambda r: r["credit_move_id"], acc_partial_rec)
|
||||
move_lines = self._recalculate_move_lines(
|
||||
move_lines,
|
||||
debit_ids,
|
||||
|
@ -414,7 +412,6 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
)
|
||||
return aged_partner_data
|
||||
|
||||
@api.multi
|
||||
def _get_report_values(self, docids, data):
|
||||
wizard_id = data["wizard_id"]
|
||||
company = self.env["res.company"].browse(data["company_id"])
|
||||
|
@ -423,6 +420,7 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
|||
partner_ids = data["partner_ids"]
|
||||
date_at = data["date_at"]
|
||||
date_at_object = datetime.strptime(date_at, "%Y-%m-%d").date()
|
||||
|
||||
only_posted_moves = data["only_posted_moves"]
|
||||
show_move_line_details = data["show_move_line_details"]
|
||||
(
|
||||
|
|
|
@ -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 XLSL Report"
|
||||
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||
|
||||
def _get_report_name(self, report, data=False):
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
|
||||
import calendar
|
||||
import datetime
|
||||
from operator import itemgetter
|
||||
|
||||
from natsort import natsorted
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class GeneralLedgerReport(models.AbstractModel):
|
||||
_name = "report.account_financial_report.general_ledger"
|
||||
_description = "General Ledger Report"
|
||||
|
||||
def _get_accounts_data(self, account_ids):
|
||||
accounts = self.env["account.account"].browse(account_ids)
|
||||
|
@ -601,7 +599,6 @@ class GeneralLedgerReport(models.AbstractModel):
|
|||
list_centralized_ml += list(centralized_ml[jnl_id].values())
|
||||
return list_centralized_ml
|
||||
|
||||
@api.multi
|
||||
def _get_report_values(self, docids, data):
|
||||
wizard_id = data["wizard_id"]
|
||||
company = self.env["res.company"].browse(data["company_id"])
|
||||
|
@ -669,7 +666,7 @@ class GeneralLedgerReport(models.AbstractModel):
|
|||
account["move_lines"] = centralized_ml
|
||||
account["partners"] = False
|
||||
del account["list_partner"]
|
||||
general_ledger = natsorted(general_ledger, key=itemgetter("code"))
|
||||
general_ledger = sorted(general_ledger, key=lambda k: k["code"])
|
||||
return {
|
||||
"doc_ids": [wizard_id],
|
||||
"doc_model": "general.ledger.report.wizard",
|
||||
|
|
|
@ -8,6 +8,7 @@ from odoo import _, models
|
|||
|
||||
class GeneralLedgerXslx(models.AbstractModel):
|
||||
_name = "report.a_f_r.report_general_ledger_xlsx"
|
||||
_description = "General Ledger XLSL Report"
|
||||
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||
|
||||
def _get_report_name(self, report, data=False):
|
||||
|
@ -93,7 +94,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
_("Account balance at 0 filter"),
|
||||
_("Hide") if report.hide_account_at_0 else _("Show"),
|
||||
],
|
||||
[_("Centralize filter"), _("Yes") if report.centralize else _("No"),],
|
||||
[_("Centralize filter"), _("Yes") if report.centralize else _("No")],
|
||||
[
|
||||
_("Show analytic tags"),
|
||||
_("Yes") if report.show_analytic_tags else _("No"),
|
||||
|
@ -119,6 +120,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
def _get_col_pos_final_balance_label(self):
|
||||
return 5
|
||||
|
||||
# flake8: noqa: C901
|
||||
def _generate_report_content(self, workbook, report, data):
|
||||
res_data = self.env[
|
||||
"report.account_financial_report.general_ledger"
|
||||
|
@ -152,7 +154,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
)
|
||||
if foreign_currency:
|
||||
account.update(
|
||||
{"initial_bal_curr": account["init_bal"]["bal_curr"],}
|
||||
{"initial_bal_curr": account["init_bal"]["bal_curr"]}
|
||||
)
|
||||
self.write_initial_balance_from_dict(account)
|
||||
|
||||
|
@ -184,7 +186,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
for tag_id in line["tag_ids"]:
|
||||
tags += tags_data[tag_id]["name"] + " "
|
||||
line.update(
|
||||
{"taxes_description": taxes_description, "tags": tags,}
|
||||
{"taxes_description": taxes_description, "tags": tags}
|
||||
)
|
||||
self.write_line_from_dict(line)
|
||||
|
||||
|
@ -210,7 +212,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
)
|
||||
if foreign_currency:
|
||||
partner.update(
|
||||
{"initial_bal_culrr": partner["init_bal"]["bal_curr"],}
|
||||
{"initial_bal_culrr": partner["init_bal"]["bal_curr"]}
|
||||
)
|
||||
self.write_initial_balance_from_dict(partner)
|
||||
|
||||
|
@ -235,7 +237,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
for tag_id in line["tag_ids"]:
|
||||
tags += tags_data[tag_id]["name"] + " "
|
||||
line.update(
|
||||
{"taxes_description": taxes_description, "tags": tags,}
|
||||
{"taxes_description": taxes_description, "tags": tags}
|
||||
)
|
||||
self.write_line_from_dict(line)
|
||||
|
||||
|
@ -249,7 +251,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
)
|
||||
if foreign_currency:
|
||||
partner.update(
|
||||
{"final_bal_curr": partner["fin_bal"]["bal_curr"],}
|
||||
{"final_bal_curr": partner["fin_bal"]["bal_curr"]}
|
||||
)
|
||||
self.write_ending_balance_from_dict(partner)
|
||||
|
||||
|
@ -266,9 +268,7 @@ class GeneralLedgerXslx(models.AbstractModel):
|
|||
}
|
||||
)
|
||||
if foreign_currency:
|
||||
account.update(
|
||||
{"final_bal_curr": account["fin_bal"]["bal_curr"],}
|
||||
)
|
||||
account.update({"final_bal_curr": account["fin_bal"]["bal_curr"]})
|
||||
self.write_ending_balance_from_dict(account)
|
||||
|
||||
# 2 lines break
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
import itertools
|
||||
import operator
|
||||
|
||||
from odoo import api, models
|
||||
from odoo import models
|
||||
|
||||
|
||||
class JournalLedgerReport(models.AbstractModel):
|
||||
_name = "report.account_financial_report.journal_ledger"
|
||||
_description = "Journal Ledger Report"
|
||||
|
||||
def _get_journal_ledger_data(self, journal):
|
||||
return {
|
||||
|
@ -79,9 +80,7 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
|
||||
def _get_move_lines_domain(self, move_ids, wizard, journal_ids):
|
||||
|
||||
return [
|
||||
("move_id", "in", move_ids),
|
||||
]
|
||||
return [("move_id", "in", move_ids)]
|
||||
|
||||
def _get_move_lines_order(self, move_ids, wizard, journal_ids):
|
||||
return ""
|
||||
|
@ -140,9 +139,7 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
return data
|
||||
|
||||
def _get_partner_id_data(self, partner):
|
||||
return {
|
||||
"name": partner.name,
|
||||
}
|
||||
return {"name": partner.name}
|
||||
|
||||
def _get_currency_data(self, currencies):
|
||||
data = {}
|
||||
|
@ -151,9 +148,7 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
return data
|
||||
|
||||
def _get_currency_id_data(self, currency):
|
||||
return {
|
||||
"name": currency.name,
|
||||
}
|
||||
return {"name": currency.name}
|
||||
|
||||
def _get_tax_line_data(self, taxes):
|
||||
data = {}
|
||||
|
@ -162,10 +157,7 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
return data
|
||||
|
||||
def _get_tax_line_id_data(self, tax):
|
||||
return {
|
||||
"name": tax.name,
|
||||
"description": tax.description,
|
||||
}
|
||||
return {"name": tax.name, "description": tax.description}
|
||||
|
||||
def _get_query_taxes(self):
|
||||
return """
|
||||
|
@ -178,19 +170,18 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
"""
|
||||
|
||||
def _get_query_taxes_params(self, move_lines):
|
||||
return {
|
||||
"move_line_ids": tuple(move_lines.ids),
|
||||
}
|
||||
return {"move_line_ids": tuple(move_lines.ids)}
|
||||
|
||||
def _get_move_lines(self, move_ids, wizard, journal_ids):
|
||||
move_lines = self.env["account.move.line"].search(
|
||||
self._get_move_lines_domain(move_ids, wizard, journal_ids),
|
||||
order=self._get_move_lines_order(move_ids, wizard, journal_ids),
|
||||
)
|
||||
move_line_ids_taxes_data = {}
|
||||
if move_lines:
|
||||
# Get the taxes ids for the move lines
|
||||
query_taxes_params = self._get_query_taxes_params(move_lines)
|
||||
query_taxes = self._get_query_taxes()
|
||||
move_line_ids_taxes_data = {}
|
||||
self.env.cr.execute(query_taxes, query_taxes_params)
|
||||
# Fetch the taxes associated to the move line
|
||||
for (
|
||||
|
@ -292,7 +283,6 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
]
|
||||
return journals_taxes_data_2
|
||||
|
||||
@api.multi
|
||||
def _get_report_values(self, docids, data):
|
||||
wizard_id = data["wizard_id"]
|
||||
wizard = self.env["journal.ledger.report.wizard"].browse(wizard_id)
|
||||
|
@ -313,15 +303,12 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
partner_ids_data
|
||||
) = currency_ids_data = tax_line_ids_data = move_line_ids_taxes_data = {}
|
||||
if move_ids:
|
||||
(
|
||||
move_line_ids,
|
||||
move_lines_data,
|
||||
account_ids_data,
|
||||
partner_ids_data,
|
||||
currency_ids_data,
|
||||
tax_line_ids_data,
|
||||
move_line_ids_taxes_data,
|
||||
) = self._get_move_lines(move_ids, wizard, journal_ids)
|
||||
move_lines = self._get_move_lines(move_ids, wizard, journal_ids)
|
||||
move_lines_data = move_lines[1]
|
||||
account_ids_data = move_lines[2]
|
||||
partner_ids_data = move_lines[3]
|
||||
currency_ids_data = move_lines[4]
|
||||
tax_line_ids_data = move_lines[5]
|
||||
for move_data in moves_data:
|
||||
move_id = move_data["move_id"]
|
||||
move_data["report_move_lines"] = []
|
||||
|
@ -338,10 +325,7 @@ class JournalLedgerReport(models.AbstractModel):
|
|||
for move_line_data in move_lines_data[move_id]:
|
||||
journal_id = move_line_data["journal_id"]
|
||||
if journal_id not in journal_totals.keys():
|
||||
journal_totals[journal_id] = {
|
||||
"debit": 0.0,
|
||||
"credit": 0.0,
|
||||
}
|
||||
journal_totals[journal_id] = {"debit": 0.0, "credit": 0.0}
|
||||
for item in ["debit", "credit"]:
|
||||
journal_totals[journal_id][item] += move_line_data[item]
|
||||
for journal_ledger_data in journal_ledgers_data:
|
||||
|
|
|
@ -8,6 +8,7 @@ from odoo import _, models
|
|||
|
||||
class JournalLedgerXslx(models.AbstractModel):
|
||||
_name = "report.a_f_r.report_journal_ledger_xlsx"
|
||||
_description = "Journal Ledger XLSX Report"
|
||||
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||
|
||||
def _get_report_name(self, report, data=False):
|
||||
|
@ -35,7 +36,7 @@ class JournalLedgerXslx(models.AbstractModel):
|
|||
{"header": _("Partner"), "field": "partner", "width": 25},
|
||||
{"header": _("Ref - Label"), "field": "label", "width": 40},
|
||||
{"header": _("Taxes"), "field": "taxes_description", "width": 11},
|
||||
{"header": _("Debit"), "field": "debit", "type": "amount", "width": 14,},
|
||||
{"header": _("Debit"), "field": "debit", "type": "amount", "width": 14},
|
||||
{"header": _("Credit"), "field": "credit", "type": "amount", "width": 14},
|
||||
]
|
||||
|
||||
|
@ -188,7 +189,9 @@ class JournalLedgerXslx(models.AbstractModel):
|
|||
and journal.currency_id.name
|
||||
or journal.company_id.currency_id.name
|
||||
)
|
||||
sheet_name = "Tax - {} ({}) - {}".format(journal.code, currency_name, journal.name)
|
||||
sheet_name = "Tax - {} ({}) - {}".format(
|
||||
journal.code, currency_name, journal.name
|
||||
)
|
||||
self._generate_taxes_summary(workbook, sheet_name, ledger["tax_lines"])
|
||||
|
||||
def _generate_moves_content(self, workbook, sheet_name, report, res_data, moves):
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
from datetime import date, datetime
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from odoo import api, models
|
||||
from odoo.osv import expression
|
||||
from odoo.tools import float_is_zero
|
||||
|
@ -13,6 +11,7 @@ from odoo.tools import float_is_zero
|
|||
|
||||
class OpenItemsReport(models.AbstractModel):
|
||||
_name = "report.account_financial_report.open_items"
|
||||
_description = "Open Items Report"
|
||||
|
||||
@api.model
|
||||
def get_html(self, given_context=None):
|
||||
|
@ -63,7 +62,7 @@ class OpenItemsReport(models.AbstractModel):
|
|||
credit_move_id
|
||||
] += account_partial_reconcile_data["amount"]
|
||||
account_partial_reconcile_data.update(
|
||||
{"debit_move_id": debit_move_id, "credit_move_id": credit_move_id,}
|
||||
{"debit_move_id": debit_move_id, "credit_move_id": credit_move_id}
|
||||
)
|
||||
return (
|
||||
accounts_partial_reconcile,
|
||||
|
@ -188,6 +187,7 @@ class OpenItemsReport(models.AbstractModel):
|
|||
journals_data.update({journal.id: {"id": journal.id, "code": journal.code}})
|
||||
return journals_data
|
||||
|
||||
# flake8: noqa: C901
|
||||
def _get_data(
|
||||
self,
|
||||
account_ids,
|
||||
|
@ -201,12 +201,11 @@ class OpenItemsReport(models.AbstractModel):
|
|||
account_ids, partner_ids, date_at_object, target_move, company_id, date_from
|
||||
)
|
||||
self._cr.execute(query)
|
||||
move_lines_data = pd.DataFrame(self._cr.dictfetchall())
|
||||
account_ids = set(move_lines_data.account_id.to_list())
|
||||
move_lines_data = self._cr.dictfetchall()
|
||||
account_ids = map(lambda r: r["account_id"], move_lines_data)
|
||||
accounts_data = self._get_accounts_data(list(account_ids))
|
||||
journal_ids = set(move_lines_data.journal_id.to_list())
|
||||
journal_ids = map(lambda r: r["journal_id"], move_lines_data)
|
||||
journals_data = self._get_journals_data(list(journal_ids))
|
||||
move_lines_data = move_lines_data.fillna(0).to_dict(orient="records")
|
||||
|
||||
if date_at_object < date.today():
|
||||
(
|
||||
|
@ -215,12 +214,11 @@ class OpenItemsReport(models.AbstractModel):
|
|||
credit_accounts_partial_amount,
|
||||
) = self._get_account_partial_reconciled(move_lines_data, date_at_object)
|
||||
if accounts_partial_reconcile:
|
||||
accounts_partial_reconcile_data = pd.DataFrame(
|
||||
accounts_partial_reconcile
|
||||
debit_ids = map(
|
||||
operator.itemgetter("debit_move_id"), accounts_partial_reconcile
|
||||
)
|
||||
debit_ids = set(accounts_partial_reconcile_data.debit_move_id.to_list())
|
||||
credit_ids = set(
|
||||
accounts_partial_reconcile_data.credit_move_id.to_list()
|
||||
credit_ids = map(
|
||||
operator.itemgetter("credit_move_id"), accounts_partial_reconcile
|
||||
)
|
||||
for move_line in move_lines_data:
|
||||
if move_line["id"] in debit_ids:
|
||||
|
@ -245,7 +243,7 @@ class OpenItemsReport(models.AbstractModel):
|
|||
for move_line in move_lines_data:
|
||||
no_partner = True
|
||||
# Partners data
|
||||
if move_line["partner_id"] and not pd.isna(move_line["partner_id"]):
|
||||
if move_line["partner_id"]:
|
||||
no_partner = False
|
||||
partners_data.update(
|
||||
{
|
||||
|
@ -270,11 +268,11 @@ class OpenItemsReport(models.AbstractModel):
|
|||
original = move_line["credit"] * (-1)
|
||||
if not float_is_zero(move_line["debit"], precision_digits=2):
|
||||
original = move_line["debit"]
|
||||
|
||||
move_line.update(
|
||||
{
|
||||
"date": move_line["date"].strftime("%d/%m/%Y"),
|
||||
"date_maturity": move_line["date_maturity"].strftime("%d/%m/%Y"),
|
||||
"date_maturity": move_line["date_maturity"]
|
||||
and move_line["date_maturity"].strftime("%d/%m/%Y"),
|
||||
"original": original,
|
||||
"partner_id": 0 if no_partner else move_line["partner_id"],
|
||||
"partner_name": "" if no_partner else move_line["partner_name"],
|
||||
|
@ -325,7 +323,6 @@ class OpenItemsReport(models.AbstractModel):
|
|||
total_amount[account_id]["residual"] += move_line["amount_residual"]
|
||||
return total_amount
|
||||
|
||||
@api.multi
|
||||
def _get_report_values(self, docids, data):
|
||||
wizard_id = data["wizard_id"]
|
||||
company = self.env["res.company"].browse(data["company_id"])
|
||||
|
|
|
@ -7,6 +7,7 @@ from odoo import _, models
|
|||
|
||||
class OpenItemsXslx(models.AbstractModel):
|
||||
_name = "report.a_f_r.report_open_items_xlsx"
|
||||
_description = "Open Items XLSX Report"
|
||||
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||
|
||||
def _get_report_name(self, report, data=False):
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
|
||||
from operator import itemgetter
|
||||
|
||||
from natsort import natsorted
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class TrialBalanceReport(models.AbstractModel):
|
||||
_name = "report.account_financial_report.trial_balance"
|
||||
_description = "Trial Balance Report"
|
||||
|
||||
@api.model
|
||||
def get_html(self, given_context=None):
|
||||
|
@ -203,6 +202,7 @@ class TrialBalanceReport(models.AbstractModel):
|
|||
pl_initial_currency_balance += initial_balance["amount_currency"]
|
||||
return pl_initial_balance, pl_initial_currency_balance
|
||||
|
||||
# flake8: noqa: C901
|
||||
def _get_data(
|
||||
self,
|
||||
account_ids,
|
||||
|
@ -343,7 +343,7 @@ class TrialBalanceReport(models.AbstractModel):
|
|||
prt_id = tb["partner_id"][0]
|
||||
if tb["partner_id"] not in partners_ids:
|
||||
partners_data.update(
|
||||
{prt_id: {"id": prt_id, "name": tb["partner_id"][1],}}
|
||||
{prt_id: {"id": prt_id, "name": tb["partner_id"][1]}}
|
||||
)
|
||||
total_amount[acc_id][prt_id] = {}
|
||||
total_amount[acc_id][prt_id]["credit"] = tb["credit"]
|
||||
|
@ -363,7 +363,7 @@ class TrialBalanceReport(models.AbstractModel):
|
|||
prt_id = tb["partner_id"][0]
|
||||
if tb["partner_id"] not in partners_ids:
|
||||
partners_data.update(
|
||||
{prt_id: {"id": prt_id, "name": tb["partner_id"][1],}}
|
||||
{prt_id: {"id": prt_id, "name": tb["partner_id"][1]}}
|
||||
)
|
||||
if acc_id not in total_amount.keys():
|
||||
total_amount[acc_id][prt_id] = {}
|
||||
|
@ -620,7 +620,6 @@ class TrialBalanceReport(models.AbstractModel):
|
|||
] += total_amount[acc_id]["ending_currency_balance"]
|
||||
return groups_data
|
||||
|
||||
@api.multi
|
||||
def _get_report_values(self, docids, data):
|
||||
show_partner_details = data["show_partner_details"]
|
||||
wizard_id = data["wizard_id"]
|
||||
|
@ -682,9 +681,7 @@ class TrialBalanceReport(models.AbstractModel):
|
|||
)
|
||||
trial_balance = list(groups_data.values())
|
||||
trial_balance += list(accounts_data.values())
|
||||
trial_balance = natsorted(
|
||||
trial_balance, key=itemgetter("complete_code", "code")
|
||||
)
|
||||
trial_balance = sorted(trial_balance, key=lambda k: k["complete_code"])
|
||||
for trial in trial_balance:
|
||||
counter = trial["complete_code"].count("/")
|
||||
trial["level"] = counter
|
||||
|
@ -694,10 +691,10 @@ class TrialBalanceReport(models.AbstractModel):
|
|||
)
|
||||
trial_balance = list(groups_data.values())
|
||||
trial_balance += list(accounts_data.values())
|
||||
trial_balance = natsorted(trial_balance, key=itemgetter("code"))
|
||||
trial_balance = sorted(trial_balance, key=lambda k: k["code"])
|
||||
if hierarchy_on == "none":
|
||||
trial_balance = list(accounts_data.values())
|
||||
trial_balance = natsorted(trial_balance, key=itemgetter("code"))
|
||||
trial_balance = sorted(trial_balance, key=lambda k: k["code"])
|
||||
else:
|
||||
if foreign_currency:
|
||||
for account_id in accounts_data.keys():
|
||||
|
|
|
@ -8,6 +8,7 @@ from odoo import _, models
|
|||
|
||||
class TrialBalanceXslx(models.AbstractModel):
|
||||
_name = "report.a_f_r.report_trial_balance_xlsx"
|
||||
_description = "Trial Balance XLSX Report"
|
||||
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||
|
||||
def _get_report_name(self, report, data=False):
|
||||
|
|
|
@ -7,6 +7,7 @@ from odoo import api, models
|
|||
|
||||
class VATReport(models.AbstractModel):
|
||||
_name = "report.account_financial_report.vat_report"
|
||||
_description = "Vat Report Report"
|
||||
|
||||
def _get_tax_data(self, tax_ids):
|
||||
taxes = self.env["account.tax"].browse(tax_ids)
|
||||
|
@ -18,7 +19,6 @@ class VATReport(models.AbstractModel):
|
|||
"id": tax.id,
|
||||
"name": tax.name,
|
||||
"tax_group_id": tax.tax_group_id.id,
|
||||
"tags_ids": tax.tag_ids.ids,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -42,15 +42,19 @@ class VATReport(models.AbstractModel):
|
|||
"tax_base_amount",
|
||||
"balance",
|
||||
"tax_line_id",
|
||||
"tax_repartition_line_id",
|
||||
"analytic_tag_ids",
|
||||
]
|
||||
tax_move_lines = self.env["account.move.line"].search_read(
|
||||
domain=domain, fields=ml_fields,
|
||||
domain=domain, fields=ml_fields
|
||||
)
|
||||
vat_data = {}
|
||||
tax_ids = set()
|
||||
for tax_move_line in tax_move_lines:
|
||||
tax_ml_id = tax_move_line["id"]
|
||||
repartition = self.env["account.tax.repartition.line"].browse(
|
||||
tax_move_line["tax_repartition_line_id"][0]
|
||||
)
|
||||
vat_data[tax_ml_id] = {}
|
||||
vat_data[tax_ml_id].update(
|
||||
{
|
||||
|
@ -60,6 +64,7 @@ class VATReport(models.AbstractModel):
|
|||
if tax_move_line["balance"] > 0
|
||||
else (-1) * tax_move_line["balance"],
|
||||
"tax_line_id": tax_move_line["tax_line_id"],
|
||||
"tags_ids": repartition.tag_ids.ids,
|
||||
}
|
||||
)
|
||||
tax_ids.add(tax_move_line["tax_line_id"][0])
|
||||
|
@ -90,11 +95,11 @@ class VATReport(models.AbstractModel):
|
|||
vat_report[tax_group_id] = {}
|
||||
vat_report[tax_group_id]["net"] = 0.0
|
||||
vat_report[tax_group_id]["tax"] = 0.0
|
||||
vat_report[tax_group_id][tax_id] = tax_data[tax_id]
|
||||
vat_report[tax_group_id][tax_id] = dict(tax_data[tax_id])
|
||||
vat_report[tax_group_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||
else:
|
||||
if tax_id not in vat_report[tax_group_id].keys():
|
||||
vat_report[tax_group_id][tax_id] = tax_data[tax_id]
|
||||
vat_report[tax_group_id][tax_id] = dict(tax_data[tax_id])
|
||||
vat_report[tax_group_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||
vat_report[tax_group_id]["net"] += tax_move_line["net"]
|
||||
vat_report[tax_group_id]["tax"] += tax_move_line["tax"]
|
||||
|
@ -126,18 +131,18 @@ class VATReport(models.AbstractModel):
|
|||
vat_report = {}
|
||||
for tax_move_line in vat_report_data.values():
|
||||
tax_id = tax_move_line["tax_line_id"][0]
|
||||
tags_ids = tax_data[tax_id]["tags_ids"]
|
||||
tags_ids = tax_move_line["tags_ids"]
|
||||
if tags_ids:
|
||||
for tag_id in tags_ids:
|
||||
if tag_id not in vat_report.keys():
|
||||
vat_report[tag_id] = {}
|
||||
vat_report[tag_id]["net"] = 0.0
|
||||
vat_report[tag_id]["tax"] = 0.0
|
||||
vat_report[tag_id][tax_id] = tax_data[tax_id]
|
||||
vat_report[tag_id][tax_id] = dict(tax_data[tax_id])
|
||||
vat_report[tag_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||
else:
|
||||
if tax_id not in vat_report[tag_id].keys():
|
||||
vat_report[tag_id][tax_id] = tax_data[tax_id]
|
||||
vat_report[tag_id][tax_id] = dict(tax_data[tax_id])
|
||||
vat_report[tag_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||
vat_report[tag_id][tax_id]["net"] += tax_move_line["net"]
|
||||
vat_report[tag_id][tax_id]["tax"] += tax_move_line["tax"]
|
||||
|
@ -156,7 +161,6 @@ class VATReport(models.AbstractModel):
|
|||
vat_report_list.append(vat_report[tag_id])
|
||||
return vat_report_list
|
||||
|
||||
@api.multi
|
||||
def _get_report_values(self, docids, data):
|
||||
wizard_id = data["wizard_id"]
|
||||
company = self.env["res.company"].browse(data["company_id"])
|
||||
|
|
|
@ -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 Report"
|
||||
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||
|
||||
def _get_report_name(self, report, data):
|
||||
|
|
|
@ -367,9 +367,9 @@ ul.auto-toc {
|
|||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/12.0/account_financial_report"><img alt="OCA/account-financial-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-reporting-12-0/account-financial-reporting-12-0-account_financial_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/91/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/13.0/account_financial_report"><img alt="OCA/account-financial-reporting" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-reporting-13-0/account-financial-reporting-13-0-account_financial_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/91/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module adds a set of financial reports. They are accessible under
|
||||
Accounting / Reporting / OCA Reports.</p>
|
||||
Invoicing / Reporting / OCA accounting reports.</p>
|
||||
<ul class="simple">
|
||||
<li>General ledger</li>
|
||||
<li>Trial Balance</li>
|
||||
|
@ -386,31 +386,44 @@ currency balances are not available.</p>
|
|||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#changelog" id="id4">Changelog</a><ul>
|
||||
<li><a class="reference internal" href="#id1" id="id5">11.0.2.5.0 (2019-04-26)</a></li>
|
||||
<li><a class="reference internal" href="#id2" id="id6">11.0.2.4.1 (2019-01-08)</a></li>
|
||||
<li><a class="reference internal" href="#id3" id="id7">11.0.2.3.1 (2018-11-29)</a></li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#changelog" id="id5">Changelog</a><ul>
|
||||
<li><a class="reference internal" href="#id1" id="id6">11.0.2.5.0 (2019-04-26)</a></li>
|
||||
<li><a class="reference internal" href="#id2" id="id7">11.0.2.4.1 (2019-01-08)</a></li>
|
||||
<li><a class="reference internal" href="#id3" id="id8">11.0.2.3.1 (2018-11-29)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id8">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id9">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id10">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id11">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id12">Maintainers</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id9">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id10">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id11">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id12">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id13">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#id4">Known issues / Roadmap</a></h1>
|
||||
<ul class="simple">
|
||||
<li>‘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.</li>
|
||||
<li>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</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="changelog">
|
||||
<h1><a class="toc-backref" href="#id4">Changelog</a></h1>
|
||||
<h1><a class="toc-backref" href="#id5">Changelog</a></h1>
|
||||
<div class="section" id="id1">
|
||||
<h2><a class="toc-backref" href="#id5">11.0.2.5.0 (2019-04-26)</a></h2>
|
||||
<h2><a class="toc-backref" href="#id6">11.0.2.5.0 (2019-04-26)</a></h2>
|
||||
<ul class="simple">
|
||||
<li>In the Trial Balance you have an option to hide parent hierarchy levels</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<h2><a class="toc-backref" href="#id6">11.0.2.4.1 (2019-01-08)</a></h2>
|
||||
<h2><a class="toc-backref" href="#id7">11.0.2.4.1 (2019-01-08)</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Handle better multicompany behaviour</li>
|
||||
<li>Improve how title appears in the reports</li>
|
||||
|
@ -418,7 +431,7 @@ currency balances are not available.</p>
|
|||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h2><a class="toc-backref" href="#id7">11.0.2.3.1 (2018-11-29)</a></h2>
|
||||
<h2><a class="toc-backref" href="#id8">11.0.2.3.1 (2018-11-29)</a></h2>
|
||||
<ul class="simple">
|
||||
<li>In the Trial Balance you can apply a filter by hierarchy levels</li>
|
||||
<li>In the General Ledger you can apply a filter by Analytic Tag</li>
|
||||
|
@ -427,28 +440,28 @@ currency balances are not available.</p>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id8">Bug Tracker</a></h1>
|
||||
<h1><a class="toc-backref" href="#id9">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-reporting/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_financial_report%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_financial_report%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h1><a class="toc-backref" href="#id9">Credits</a></h1>
|
||||
<h1><a class="toc-backref" href="#id10">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id10">Authors</a></h2>
|
||||
<h2><a class="toc-backref" href="#id11">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Camptocamp SA</li>
|
||||
<li>initOS GmbH</li>
|
||||
<li>redCOR AG</li>
|
||||
<li>Eficent</li>
|
||||
<li>ForgeFlow</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id11">Contributors</a></h2>
|
||||
<h2><a class="toc-backref" href="#id12">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Jordi Ballester <<a class="reference external" href="mailto:jordi.ballester@eficient.com">jordi.ballester@eficient.com</a>></li>
|
||||
<li>Jordi Ballester <<a class="reference external" href="mailto:jordi.ballester@forgeflow.com">jordi.ballester@forgeflow.com</a>></li>
|
||||
<li>Yannick Vaucher <<a class="reference external" href="mailto:yannick.vaucher@camptocamp.com">yannick.vaucher@camptocamp.com</a>></li>
|
||||
<li>Simone Orsi <<a class="reference external" href="mailto:simone.orsi@abstract.com">simone.orsi@abstract.com</a>></li>
|
||||
<li>Leonardo Pistone <<a class="reference external" href="mailto:leonardo.pistone@camptocamp.com">leonardo.pistone@camptocamp.com</a>></li>
|
||||
|
@ -464,10 +477,12 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
<li>Akim Juillerat <<a class="reference external" href="mailto:akim.juillerat@camptocamp.com">akim.juillerat@camptocamp.com</a>></li>
|
||||
<li>Alexis de Lattre <<a class="reference external" href="mailto:alexis@via.ecp.fr">alexis@via.ecp.fr</a>></li>
|
||||
<li>Mihai Fekete <<a class="reference external" href="mailto:feketemihai@gmail.com">feketemihai@gmail.com</a>></li>
|
||||
<li>Miquel Raïch <<a class="reference external" href="mailto:miquel.raich@eficent.com">miquel.raich@eficent.com</a>></li>
|
||||
<li>Miquel Raïch <<a class="reference external" href="mailto:miquel.raich@forgeflow.com">miquel.raich@forgeflow.com</a>></li>
|
||||
<li>Joan Sisquella <<a class="reference external" href="mailto:joan.sisquella@forgeflow.com">joan.sisquella@forgeflow.com</a>></li>
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>Pedro M. Baeza</li>
|
||||
<li>Sergio Teruel</li>
|
||||
<li>Ernesto Tejeda</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -475,13 +490,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
April 2016.</p>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id12">Maintainers</a></h2>
|
||||
<h2><a class="toc-backref" href="#id13">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/12.0/account_financial_report">OCA/account-financial-reporting</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-reporting/tree/13.0/account_financial_report">OCA/account-financial-reporting</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -18,6 +18,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
|||
self.previous_fy_date_end = fields.Date.from_string("2015-12-31")
|
||||
self.fy_date_start = fields.Date.from_string("2016-01-01")
|
||||
self.fy_date_end = fields.Date.from_string("2016-12-31")
|
||||
|
||||
self.receivable_account = self.env["account.account"].search(
|
||||
[("user_type_id.name", "=", "Receivable")], limit=1
|
||||
)
|
||||
|
@ -46,19 +47,16 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
|||
unaffected_debit=0,
|
||||
unaffected_credit=0,
|
||||
):
|
||||
move_name = "expense accrual"
|
||||
journal = self.env["account.journal"].search([], limit=1)
|
||||
partner = self.env.ref("base.res_partner_12")
|
||||
move_vals = {
|
||||
"journal_id": journal.id,
|
||||
"name": move_name,
|
||||
"date": date,
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": receivable_debit,
|
||||
"credit": receivable_credit,
|
||||
"account_id": self.receivable_account.id,
|
||||
|
@ -69,7 +67,6 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
|||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": income_debit,
|
||||
"credit": income_credit,
|
||||
"account_id": self.income_account.id,
|
||||
|
@ -80,7 +77,6 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
|||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": unaffected_debit,
|
||||
"credit": unaffected_credit,
|
||||
"account_id": self.unaffected_account.id,
|
||||
|
@ -678,9 +674,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
|||
|
||||
def test_validate_date(self):
|
||||
company_id = self.env.ref("base.main_company")
|
||||
company_id.write(
|
||||
{"fiscalyear_last_day": 31, "fiscalyear_last_month": 12,}
|
||||
)
|
||||
company_id.write({"fiscalyear_last_day": 31, "fiscalyear_last_month": "12"})
|
||||
user = self.env.ref("base.user_root").with_context(company_id=company_id.id)
|
||||
wizard = self.env["general.ledger.report.wizard"].with_context(user=user.id)
|
||||
self.assertEqual(wizard._init_date_from(), time.strftime("%Y") + "-01-01")
|
||||
|
|
|
@ -7,14 +7,14 @@ from datetime import datetime
|
|||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo.fields import Date
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tests.common import Form, TransactionCase
|
||||
|
||||
|
||||
class TestJournalReport(TransactionCase):
|
||||
def setUp(self):
|
||||
super(TestJournalReport, self).setUp()
|
||||
self.AccountObj = self.env["account.account"]
|
||||
self.InvoiceObj = self.env["account.invoice"]
|
||||
self.InvoiceObj = self.env["account.move"]
|
||||
self.JournalObj = self.env["account.journal"]
|
||||
self.MoveObj = self.env["account.move"]
|
||||
self.TaxObj = self.env["account.tax"]
|
||||
|
@ -24,6 +24,8 @@ class TestJournalReport(TransactionCase):
|
|||
"report.account_financial_report.journal_ledger"
|
||||
]
|
||||
self.company = self.env.ref("base.main_company")
|
||||
self.company.account_sale_tax_id = False
|
||||
self.company.account_purchase_tax_id = False
|
||||
|
||||
today = datetime.today()
|
||||
last_year = today - relativedelta(years=1)
|
||||
|
@ -39,6 +41,9 @@ class TestJournalReport(TransactionCase):
|
|||
self.income_account = self.AccountObj.search(
|
||||
[("user_type_id.name", "=", "Income")], limit=1
|
||||
)
|
||||
self.expense_account = self.AccountObj.search(
|
||||
[("user_type_id.name", "=", "Expenses")], limit=1
|
||||
)
|
||||
self.payable_account = self.AccountObj.search(
|
||||
[("user_type_id.name", "=", "Payable")], limit=1
|
||||
)
|
||||
|
@ -55,7 +60,7 @@ class TestJournalReport(TransactionCase):
|
|||
{
|
||||
"name": "Test journal purchase",
|
||||
"code": "TST-JRNL-P",
|
||||
"type": "sale",
|
||||
"type": "purchase",
|
||||
"company_id": self.company.id,
|
||||
}
|
||||
)
|
||||
|
@ -194,6 +199,7 @@ class TestJournalReport(TransactionCase):
|
|||
"date_to": self.fy_date_end,
|
||||
"company_id": self.company.id,
|
||||
"journal_ids": [(6, 0, self.journal_sale.ids)],
|
||||
"move_target": "all",
|
||||
}
|
||||
)
|
||||
data = wiz._prepare_report_journal_ledger()
|
||||
|
@ -227,39 +233,26 @@ class TestJournalReport(TransactionCase):
|
|||
self.check_report_journal_debit_credit(res_data, 300, 300)
|
||||
|
||||
def test_02_test_taxes_out_invoice(self):
|
||||
invoice_values = {
|
||||
"journal_id": self.journal_sale.id,
|
||||
"partner_id": self.partner_2.id,
|
||||
"type": "out_invoice",
|
||||
"invoice_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"quantity": 1.0,
|
||||
"price_unit": 100,
|
||||
"account_id": self.receivable_account.id,
|
||||
"name": "Test",
|
||||
"invoice_line_tax_ids": [(6, 0, [self.tax_15_s.id])],
|
||||
},
|
||||
),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"quantity": 1.0,
|
||||
"price_unit": 100,
|
||||
"account_id": self.receivable_account.id,
|
||||
"name": "Test",
|
||||
"invoice_line_tax_ids": [
|
||||
(6, 0, [self.tax_15_s.id, self.tax_20_s.id])
|
||||
],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
invoice = self.InvoiceObj.create(invoice_values)
|
||||
invoice.action_invoice_open()
|
||||
move_form = Form(
|
||||
self.env["account.move"].with_context(default_type="out_invoice")
|
||||
)
|
||||
move_form.partner_id = self.partner_2
|
||||
move_form.journal_id = self.journal_sale
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.name = "test"
|
||||
line_form.quantity = 1.0
|
||||
line_form.price_unit = 100
|
||||
line_form.account_id = self.income_account
|
||||
line_form.tax_ids.add(self.tax_15_s)
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.name = "test"
|
||||
line_form.quantity = 1.0
|
||||
line_form.price_unit = 100
|
||||
line_form.account_id = self.income_account
|
||||
line_form.tax_ids.add(self.tax_15_s)
|
||||
line_form.tax_ids.add(self.tax_20_s)
|
||||
invoice = move_form.save()
|
||||
invoice.post()
|
||||
|
||||
wiz = self.JournalLedgerReportWizard.create(
|
||||
{
|
||||
|
@ -267,6 +260,7 @@ class TestJournalReport(TransactionCase):
|
|||
"date_to": self.fy_date_end,
|
||||
"company_id": self.company.id,
|
||||
"journal_ids": [(6, 0, self.journal_sale.ids)],
|
||||
"move_target": "all",
|
||||
}
|
||||
)
|
||||
data = wiz._prepare_report_journal_ledger()
|
||||
|
@ -275,46 +269,68 @@ class TestJournalReport(TransactionCase):
|
|||
self.check_report_journal_debit_credit_taxes(res_data, 0, 300, 0, 50)
|
||||
|
||||
def test_03_test_taxes_in_invoice(self):
|
||||
invoice_values = {
|
||||
"journal_id": self.journal_sale.id,
|
||||
"partner_id": self.partner_2.id,
|
||||
"type": "in_invoice",
|
||||
"invoice_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"quantity": 1.0,
|
||||
"price_unit": 100,
|
||||
"account_id": self.payable_account.id,
|
||||
"name": "Test",
|
||||
"invoice_line_tax_ids": [(6, 0, [self.tax_15_p.id])],
|
||||
},
|
||||
),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"quantity": 1.0,
|
||||
"price_unit": 100,
|
||||
"account_id": self.payable_account.id,
|
||||
"name": "Test",
|
||||
"invoice_line_tax_ids": [
|
||||
(6, 0, [self.tax_15_p.id, self.tax_20_p.id])
|
||||
],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
invoice = self.InvoiceObj.create(invoice_values)
|
||||
invoice.action_invoice_open()
|
||||
# invoice_values = {
|
||||
# "journal_id": self.journal_purchase.id,
|
||||
# "partner_id": self.partner_2.id,
|
||||
# "type": "in_invoice",
|
||||
# "invoice_line_ids": [
|
||||
# (
|
||||
# 0,
|
||||
# 0,
|
||||
# {
|
||||
# "quantity": 1.0,
|
||||
# "price_unit": 100,
|
||||
# "account_id": self.payable_account.id,
|
||||
# "name": "Test",
|
||||
# "tax_ids": [(6, 0, [self.tax_15_p.id])],
|
||||
# },
|
||||
# ),
|
||||
# (
|
||||
# 0,
|
||||
# 0,
|
||||
# {
|
||||
# "quantity": 1.0,
|
||||
# "price_unit": 100,
|
||||
# "account_id": self.payable_account.id,
|
||||
# "name": "Test",
|
||||
# "tax_ids": [
|
||||
# (6, 0, [self.tax_15_p.id, self.tax_20_p.id])
|
||||
# ],
|
||||
# },
|
||||
# ),
|
||||
# ],
|
||||
# }
|
||||
# invoice = self.InvoiceObj.create(invoice_values)
|
||||
# invoice.post()
|
||||
|
||||
move_form = Form(
|
||||
self.env["account.move"].with_context(default_type="in_invoice")
|
||||
)
|
||||
move_form.partner_id = self.partner_2
|
||||
move_form.journal_id = self.journal_purchase
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.name = "test"
|
||||
line_form.quantity = 1.0
|
||||
line_form.price_unit = 100
|
||||
line_form.account_id = self.expense_account
|
||||
line_form.tax_ids.add(self.tax_15_p)
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.name = "test"
|
||||
line_form.quantity = 1.0
|
||||
line_form.price_unit = 100
|
||||
line_form.account_id = self.expense_account
|
||||
line_form.tax_ids.add(self.tax_15_p)
|
||||
line_form.tax_ids.add(self.tax_20_p)
|
||||
invoice = move_form.save()
|
||||
invoice.post()
|
||||
|
||||
wiz = self.JournalLedgerReportWizard.create(
|
||||
{
|
||||
"date_from": self.fy_date_start,
|
||||
"date_to": self.fy_date_end,
|
||||
"company_id": self.company.id,
|
||||
"journal_ids": [(6, 0, self.journal_sale.ids)],
|
||||
"journal_ids": [(6, 0, self.journal_purchase.ids)],
|
||||
"move_target": "all",
|
||||
}
|
||||
)
|
||||
data = wiz._prepare_report_journal_ledger()
|
||||
|
|
|
@ -92,19 +92,16 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
unaffected_debit=0,
|
||||
unaffected_credit=0,
|
||||
):
|
||||
move_name = "expense accrual"
|
||||
journal = self.env["account.journal"].search([], limit=1)
|
||||
partner = self.env.ref("base.res_partner_12")
|
||||
move_vals = {
|
||||
"journal_id": journal.id,
|
||||
"name": move_name,
|
||||
"date": date,
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": receivable_debit,
|
||||
"credit": receivable_credit,
|
||||
"partner_id": partner.id,
|
||||
|
@ -115,7 +112,6 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": income_debit,
|
||||
"credit": income_credit,
|
||||
"partner_id": partner.id,
|
||||
|
@ -126,7 +122,6 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": unaffected_debit,
|
||||
"credit": unaffected_credit,
|
||||
"partner_id": partner.id,
|
||||
|
@ -137,7 +132,6 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": receivable_debit,
|
||||
"credit": receivable_credit,
|
||||
"partner_id": partner.id,
|
||||
|
@ -148,7 +142,6 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": receivable_credit,
|
||||
"credit": receivable_debit,
|
||||
"partner_id": partner.id,
|
||||
|
@ -240,8 +233,8 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
return total
|
||||
|
||||
def test_00_account_group(self):
|
||||
self.assertGreaterEqual(len(self.group1.compute_account_ids), 19)
|
||||
self.assertGreaterEqual(len(self.group2.compute_account_ids), 9)
|
||||
self.assertTrue(self.account100 in self.group1.compute_account_ids)
|
||||
self.assertTrue(self.account200 in self.group2.compute_account_ids)
|
||||
|
||||
def test_01_account_balance_computed(self):
|
||||
# Make sure there's no account of type "Current Year Earnings" in the
|
||||
|
@ -660,32 +653,20 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
|
||||
def test_04_undistributed_pl(self):
|
||||
# Add a P&L Move in the previous FY
|
||||
move_name = "current year pl move"
|
||||
journal = self.env["account.journal"].search([], limit=1)
|
||||
move_vals = {
|
||||
"journal_id": journal.id,
|
||||
"name": move_name,
|
||||
"date": self.previous_fy_date_end,
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": 0.0,
|
||||
"credit": 1000.0,
|
||||
"account_id": self.account300.id,
|
||||
},
|
||||
{"debit": 0.0, "credit": 1000.0, "account_id": self.account300.id},
|
||||
),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": 1000.0,
|
||||
"credit": 0.0,
|
||||
"account_id": self.account100.id,
|
||||
},
|
||||
{"debit": 1000.0, "credit": 0.0, "account_id": self.account100.id},
|
||||
),
|
||||
],
|
||||
}
|
||||
|
@ -724,32 +705,20 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
self.assertEqual(unaffected_lines["credit"], 0)
|
||||
self.assertEqual(unaffected_lines["final_balance"], -1000)
|
||||
# Add a P&L Move to the current FY
|
||||
move_name = "current year pl move"
|
||||
journal = self.env["account.journal"].search([], limit=1)
|
||||
move_vals = {
|
||||
"journal_id": journal.id,
|
||||
"name": move_name,
|
||||
"date": self.date_start,
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": 0.0,
|
||||
"credit": 1000.0,
|
||||
"account_id": self.account300.id,
|
||||
},
|
||||
{"debit": 0.0, "credit": 1000.0, "account_id": self.account300.id},
|
||||
),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": 1000.0,
|
||||
"credit": 0.0,
|
||||
"account_id": self.account100.id,
|
||||
},
|
||||
{"debit": 1000.0, "credit": 0.0, "account_id": self.account100.id},
|
||||
),
|
||||
],
|
||||
}
|
||||
|
@ -788,32 +757,20 @@ class TestTrialBalanceReport(common.TransactionCase):
|
|||
self.assertEqual(unaffected_lines["credit"], 0)
|
||||
self.assertEqual(unaffected_lines["final_balance"], -1000)
|
||||
# Add a Move including Unaffected Earnings to the current FY
|
||||
move_name = "current year unaffected earnings move"
|
||||
journal = self.env["account.journal"].search([], limit=1)
|
||||
move_vals = {
|
||||
"journal_id": journal.id,
|
||||
"name": move_name,
|
||||
"date": self.date_start,
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": 0.0,
|
||||
"credit": 1000.0,
|
||||
"account_id": self.account110.id,
|
||||
},
|
||||
{"debit": 0.0, "credit": 1000.0, "account_id": self.account110.id},
|
||||
),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": move_name,
|
||||
"debit": 1000.0,
|
||||
"credit": 0.0,
|
||||
"account_id": self.account100.id,
|
||||
},
|
||||
{"debit": 1000.0, "credit": 0.0, "account_id": self.account100.id},
|
||||
),
|
||||
],
|
||||
}
|
||||
|
|
|
@ -45,13 +45,25 @@ class TestVATReport(common.TransactionCase):
|
|||
[("type", "=", "bank"), ("company_id", "=", self.company.id)], limit=1
|
||||
)
|
||||
self.tax_tag_01 = self.env["account.account.tag"].create(
|
||||
{"name": "Tag 01", "applicability": "taxes"}
|
||||
{
|
||||
"name": "Tag 01",
|
||||
"applicability": "taxes",
|
||||
"country_id": self.company.country_id.id,
|
||||
}
|
||||
)
|
||||
self.tax_tag_02 = self.env["account.account.tag"].create(
|
||||
{"name": "Tag 02", "applicability": "taxes"}
|
||||
{
|
||||
"name": "Tag 02",
|
||||
"applicability": "taxes",
|
||||
"country_id": self.company.country_id.id,
|
||||
}
|
||||
)
|
||||
self.tax_tag_03 = self.env["account.account.tag"].create(
|
||||
{"name": "Tag 03", "applicability": "taxes"}
|
||||
{
|
||||
"name": "Tag 03",
|
||||
"applicability": "taxes",
|
||||
"country_id": self.company.country_id.id,
|
||||
}
|
||||
)
|
||||
self.tax_group_10 = self.env["account.tax.group"].create(
|
||||
{"name": "Tax 10%", "sequence": 1}
|
||||
|
@ -65,11 +77,35 @@ class TestVATReport(common.TransactionCase):
|
|||
"amount": 10.0,
|
||||
"amount_type": "percent",
|
||||
"type_tax_use": "sale",
|
||||
"account_id": self.tax_account.id,
|
||||
"company_id": self.company.id,
|
||||
"refund_account_id": self.tax_account.id,
|
||||
"tax_group_id": self.tax_group_10.id,
|
||||
"tag_ids": [(6, 0, [self.tax_tag_01.id, self.tax_tag_02.id])],
|
||||
"invoice_repartition_line_ids": [
|
||||
(0, 0, {"factor_percent": 100, "repartition_type": "base"}),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"factor_percent": 100,
|
||||
"repartition_type": "tax",
|
||||
"account_id": self.tax_account.id,
|
||||
"tag_ids": [
|
||||
(6, 0, [self.tax_tag_01.id, self.tax_tag_02.id])
|
||||
],
|
||||
},
|
||||
),
|
||||
],
|
||||
"refund_repartition_line_ids": [
|
||||
(0, 0, {"factor_percent": 100, "repartition_type": "base"}),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"factor_percent": 100,
|
||||
"repartition_type": "tax",
|
||||
"account_id": self.tax_account.id,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
self.tax_20 = self.env["account.tax"].create(
|
||||
|
@ -79,67 +115,65 @@ class TestVATReport(common.TransactionCase):
|
|||
"amount": 20.0,
|
||||
"amount_type": "percent",
|
||||
"type_tax_use": "sale",
|
||||
"tax_exigibility": "on_payment",
|
||||
"account_id": self.tax_account.id,
|
||||
"company_id": self.company.id,
|
||||
"refund_account_id": self.tax_account.id,
|
||||
"cash_basis_account_id": self.tax_account.id,
|
||||
"cash_basis_transition_account_id": self.tax_account.id,
|
||||
"tax_group_id": self.tax_group_20.id,
|
||||
"tag_ids": [(6, 0, [self.tax_tag_02.id, self.tax_tag_03.id])],
|
||||
}
|
||||
)
|
||||
|
||||
invoice = self.env["account.invoice"].create(
|
||||
"invoice_repartition_line_ids": [
|
||||
(0, 0, {"factor_percent": 100, "repartition_type": "base"}),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"partner_id": self.env.ref("base.res_partner_2").id,
|
||||
"account_id": self.receivable_account.id,
|
||||
"company_id": self.company.id,
|
||||
"date_invoice": time.strftime("%Y-%m-03"),
|
||||
"type": "out_invoice",
|
||||
}
|
||||
)
|
||||
|
||||
self.env["account.invoice.line"].create(
|
||||
"factor_percent": 100,
|
||||
"repartition_type": "tax",
|
||||
"account_id": self.tax_account.id,
|
||||
"tag_ids": [
|
||||
(6, 0, [self.tax_tag_02.id, self.tax_tag_03.id])
|
||||
],
|
||||
},
|
||||
),
|
||||
],
|
||||
"refund_repartition_line_ids": [
|
||||
(0, 0, {"factor_percent": 100, "repartition_type": "base"}),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"product_id": self.env.ref("product.product_product_4").id,
|
||||
"quantity": 1.0,
|
||||
"price_unit": 100.0,
|
||||
"invoice_id": invoice.id,
|
||||
"name": "product",
|
||||
"account_id": self.income_account.id,
|
||||
"invoice_line_tax_ids": [(6, 0, [self.tax_10.id])],
|
||||
}
|
||||
)
|
||||
invoice.compute_taxes()
|
||||
invoice.action_invoice_open()
|
||||
|
||||
self.cbinvoice = self.env["account.invoice"].create(
|
||||
{
|
||||
"partner_id": self.env.ref("base.res_partner_2").id,
|
||||
"account_id": self.receivable_account.id,
|
||||
"company_id": self.company.id,
|
||||
"date_invoice": time.strftime("%Y-%m-05"),
|
||||
"type": "out_invoice",
|
||||
"factor_percent": 100,
|
||||
"repartition_type": "tax",
|
||||
"account_id": self.tax_account.id,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
self.env["account.invoice.line"].create(
|
||||
{
|
||||
"product_id": self.env.ref("product.product_product_4").id,
|
||||
"quantity": 1.0,
|
||||
"price_unit": 500.0,
|
||||
"invoice_id": self.cbinvoice.id,
|
||||
"name": "product",
|
||||
"account_id": self.income_account.id,
|
||||
"invoice_line_tax_ids": [(6, 0, [self.tax_20.id])],
|
||||
}
|
||||
move_form = common.Form(
|
||||
self.env["account.move"].with_context(default_type="out_invoice")
|
||||
)
|
||||
self.cbinvoice.compute_taxes()
|
||||
self.cbinvoice.action_invoice_open()
|
||||
move_form.partner_id = self.env.ref("base.res_partner_2")
|
||||
move_form.invoice_date = time.strftime("%Y-%m-03")
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.product_id = self.env.ref("product.product_product_4")
|
||||
line_form.quantity = 1.0
|
||||
line_form.price_unit = 100.0
|
||||
line_form.account_id = self.income_account
|
||||
line_form.tax_ids.add(self.tax_10)
|
||||
invoice = move_form.save()
|
||||
invoice.post()
|
||||
|
||||
self.cbinvoice.pay_and_reconcile(
|
||||
self.bank_journal.id, 300, date(date.today().year, date.today().month, 10)
|
||||
move_form = common.Form(
|
||||
self.env["account.move"].with_context(default_type="out_invoice")
|
||||
)
|
||||
move_form.partner_id = self.env.ref("base.res_partner_2")
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.product_id = self.env.ref("product.product_product_4")
|
||||
line_form.quantity = 1.0
|
||||
line_form.price_unit = 250.0
|
||||
line_form.account_id = self.income_account
|
||||
line_form.tax_ids.add(self.tax_20)
|
||||
self.cbinvoice = move_form.save()
|
||||
self.cbinvoice.post()
|
||||
|
||||
def _get_report_lines(self, taxgroups=False):
|
||||
based_on = "taxtags"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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…
Reference in New Issue