diff --git a/account_financial_report/README.rst b/account_financial_report/README.rst index 1dc56d7f..b76b83e6 100644 --- a/account_financial_report/README.rst +++ b/account_financial_report/README.rst @@ -136,6 +136,8 @@ Contributors * Harald Panten * Valentin Vinagre +* Lois Rilo <lois.rilo@forgeflow.com> + Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016. diff --git a/account_financial_report/readme/CONTRIBUTORS.rst b/account_financial_report/readme/CONTRIBUTORS.rst index 7d3a130a..b460bc03 100644 --- a/account_financial_report/readme/CONTRIBUTORS.rst +++ b/account_financial_report/readme/CONTRIBUTORS.rst @@ -29,5 +29,7 @@ * Harald Panten * Valentin Vinagre +* Lois Rilo <lois.rilo@forgeflow.com> + Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016. diff --git a/account_financial_report/report/general_ledger.py b/account_financial_report/report/general_ledger.py index a410a244..ba2e2053 100644 --- a/account_financial_report/report/general_ledger.py +++ b/account_financial_report/report/general_ledger.py @@ -628,7 +628,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( diff --git a/account_financial_report/static/description/index.html b/account_financial_report/static/description/index.html index 1b3ca142..cbc074dd 100644 --- a/account_financial_report/static/description/index.html +++ b/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"> @@ -492,6 +492,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome <li>Valentin Vinagre</li> </ul> </li> +<li>Lois Rilo <<a class="reference external" href="mailto:lois.rilo@forgeflow.com">lois.rilo@forgeflow.com</a>></li> </ul> <p>Much of the work in this module was done at a sprint in Sorrento, Italy in April 2016.</p> diff --git a/account_financial_report/wizard/abstract_wizard.py b/account_financial_report/wizard/abstract_wizard.py index e00e70c8..58dfd24a 100644 --- a/account_financial_report/wizard/abstract_wizard.py +++ b/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", + ) diff --git a/account_financial_report/wizard/aged_partner_balance_wizard.py b/account_financial_report/wizard/aged_partner_balance_wizard.py index 618ffc5f..4efeface 100644 --- a/account_financial_report/wizard/aged_partner_balance_wizard.py +++ b/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.company, - 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( diff --git a/account_financial_report/wizard/general_ledger_wizard.py b/account_financial_report/wizard/general_ledger_wizard.py index d6bb2044..0b2bd8da 100644 --- a/account_financial_report/wizard/general_ledger_wizard.py +++ b/account_financial_report/wizard/general_ledger_wizard.py @@ -22,12 +22,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.company, - 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) @@ -128,8 +122,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) diff --git a/account_financial_report/wizard/journal_ledger_wizard.py b/account_financial_report/wizard/journal_ledger_wizard.py index 94d6a8bc..e871c447 100644 --- a/account_financial_report/wizard/journal_ledger_wizard.py +++ b/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.company, + default=lambda self: self.env.company.id, string="Company", required=False, ondelete="cascade", diff --git a/account_financial_report/wizard/open_items_wizard.py b/account_financial_report/wizard/open_items_wizard.py index e381cb17..6a65b61e 100644 --- a/account_financial_report/wizard/open_items_wizard.py +++ b/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.company, - 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( diff --git a/account_financial_report/wizard/trial_balance_wizard.py b/account_financial_report/wizard/trial_balance_wizard.py index a22b0495..afe35c2e 100644 --- a/account_financial_report/wizard/trial_balance_wizard.py +++ b/account_financial_report/wizard/trial_balance_wizard.py @@ -16,12 +16,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.company, - 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) diff --git a/account_financial_report/wizard/vat_report_wizard.py b/account_financial_report/wizard/vat_report_wizard.py index a4877317..54496b24 100644 --- a/account_financial_report/wizard/vat_report_wizard.py +++ b/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.company, + default=lambda self: self.env.company.id, required=False, string="Company", )