Browse Source

[13.0][FIX] account_financial_report: Correct all uses of

self.env.user.company_id. Also move company_id to the
wizard abstract model.
pull/734/head
Lois Rilo 4 years ago
parent
commit
c9d50a44f4
  1. 2
      account_financial_report/README.rst
  2. 2
      account_financial_report/readme/CONTRIBUTORS.rst
  3. 2
      account_financial_report/report/general_ledger.py
  4. 3
      account_financial_report/static/description/index.html
  5. 9
      account_financial_report/wizard/abstract_wizard.py
  6. 6
      account_financial_report/wizard/aged_partner_balance_wizard.py
  7. 11
      account_financial_report/wizard/general_ledger_wizard.py
  8. 2
      account_financial_report/wizard/journal_ledger_wizard.py
  9. 6
      account_financial_report/wizard/open_items_wizard.py
  10. 6
      account_financial_report/wizard/trial_balance_wizard.py
  11. 2
      account_financial_report/wizard/vat_report_wizard.py

2
account_financial_report/README.rst

@ -129,6 +129,8 @@ Contributors
* Sergio Teruel
* Ernesto Tejeda
* Lois Rilo <lois.rilo@forgeflow.com>
Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.

2
account_financial_report/readme/CONTRIBUTORS.rst

@ -22,5 +22,7 @@
* Sergio Teruel
* Ernesto Tejeda
* Lois Rilo <lois.rilo@forgeflow.com>
Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.

2
account_financial_report/report/general_ledger.py

@ -615,7 +615,7 @@ class GeneralLedgerReport(models.AbstractModel):
hide_account_at_0,
):
general_ledger = []
rounding = self.env.user.company_id.currency_id.rounding
rounding = self.env.company.currency_id.rounding
for acc_id in gen_led_data.keys():
account = {}
account.update(

3
account_financial_report/static/description/index.html

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.15.2: http://docutils.sourceforge.net/" />
<title>Account Financial Reports</title>
<style type="text/css">
@ -485,6 +485,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Ernesto Tejeda</li>
</ul>
</li>
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
</ul>
<p>Much of the work in this module was done at a sprint in Sorrento, Italy in
April 2016.</p>

9
account_financial_report/wizard/abstract_wizard.py

@ -1,7 +1,7 @@
# Copyright 2019 Lorenzo Battistini @ TAKOBI
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
from odoo import fields, models
class AbstractWizard(models.AbstractModel):
@ -27,3 +27,10 @@ class AbstractWizard(models.AbstractModel):
partners -= corp_partners
partners |= corp_partners.mapped("commercial_partner_id")
return partners.ids
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.company.id,
required=False,
string="Company",
)

6
account_financial_report/wizard/aged_partner_balance_wizard.py

@ -13,12 +13,6 @@ class AgedPartnerBalanceWizard(models.TransientModel):
_description = "Aged Partner Balance Wizard"
_inherit = "account_financial_report_abstract_wizard"
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
required=False,
string="Company",
)
date_at = fields.Date(required=True, default=fields.Date.context_today)
date_from = fields.Date(string="Date From")
target_move = fields.Selection(

11
account_financial_report/wizard/general_ledger_wizard.py

@ -21,12 +21,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
_description = "General Ledger Report Wizard"
_inherit = "account_financial_report_abstract_wizard"
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
required=False,
string="Company",
)
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
date_from = fields.Date(required=True, default=lambda self: self._init_date_from())
date_to = fields.Date(required=True, default=fields.Date.context_today)
@ -119,8 +113,9 @@ 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)
last_fsc_month = self.env.user.company_id.fiscalyear_last_month
last_fsc_day = self.env.user.company_id.fiscalyear_last_day
company = self.company_id or self.env.company
last_fsc_month = company.fiscalyear_last_month
last_fsc_day = company.fiscalyear_last_day
if (
today.month < int(last_fsc_month)

2
account_financial_report/wizard/journal_ledger_wizard.py

@ -12,7 +12,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.id,
string="Company",
required=False,
ondelete="cascade",

6
account_financial_report/wizard/open_items_wizard.py

@ -13,12 +13,6 @@ class OpenItemsReportWizard(models.TransientModel):
_description = "Open Items Report Wizard"
_inherit = "account_financial_report_abstract_wizard"
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
required=False,
string="Company",
)
date_at = fields.Date(required=True, default=fields.Date.context_today)
date_from = fields.Date(string="Date From")
target_move = fields.Selection(

6
account_financial_report/wizard/trial_balance_wizard.py

@ -15,12 +15,6 @@ class TrialBalanceReportWizard(models.TransientModel):
_description = "Trial Balance Report Wizard"
_inherit = "account_financial_report_abstract_wizard"
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.user.company_id,
required=False,
string="Company",
)
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
date_from = fields.Date(required=True)
date_to = fields.Date(required=True)

2
account_financial_report/wizard/vat_report_wizard.py

@ -11,7 +11,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.id,
required=False,
string="Company",
)

Loading…
Cancel
Save