[FIX] account_financial_report_qweb: Make fy_start_date a computed field
parent
36320abd49
commit
8ccc5d57ee
|
@ -37,7 +37,7 @@ Images
|
||||||
Contributors
|
Contributors
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* Jordi Ballestrer <jordi.ballestrer@eficient.com>
|
* Jordi Ballester <jordi.ballester@eficient.com>
|
||||||
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
||||||
* Simone Orsi <simone.orsi@abstract.com>
|
* Simone Orsi <simone.orsi@abstract.com>
|
||||||
* Leonardo Pistone <leonardo.pistone@camptocamp.com>
|
* Leonardo Pistone <leonardo.pistone@camptocamp.com>
|
||||||
|
@ -51,6 +51,7 @@ Contributors
|
||||||
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
|
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
|
||||||
* Julien Coux <julien.coux@camptocamp.com>
|
* Julien Coux <julien.coux@camptocamp.com>
|
||||||
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||||
|
* Alexis de Lattre <alexis@via.ecp.fr>
|
||||||
|
|
||||||
Much of the work in this module was done at a sprint in Sorrento, Italy in
|
Much of the work in this module was done at a sprint in Sorrento, Italy in
|
||||||
April 2016.
|
April 2016.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# Author: Damien Crier
|
# Author: Damien Crier
|
||||||
# Author: Julien Coux
|
# Author: Julien Coux
|
||||||
# Copyright 2016 Camptocamp SA
|
# Copyright 2016 Camptocamp SA
|
||||||
|
# Copyright 2017 Akretion - Alexis de Lattre
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
|
@ -24,7 +25,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
)
|
)
|
||||||
date_from = fields.Date(required=True)
|
date_from = fields.Date(required=True)
|
||||||
date_to = fields.Date(required=True)
|
date_to = fields.Date(required=True)
|
||||||
fy_start_date = fields.Date(required=True)
|
fy_start_date = fields.Date(compute='_compute_fy_start_date')
|
||||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
||||||
('all', 'All Entries')],
|
('all', 'All Entries')],
|
||||||
string='Target Moves',
|
string='Target Moves',
|
||||||
|
@ -59,6 +60,13 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
string='Not only one unaffected earnings account'
|
string='Not only one unaffected earnings account'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@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 = res['date_from']
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange('company_id')
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
"""Handle company change."""
|
"""Handle company change."""
|
||||||
|
@ -75,10 +83,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
"""Handle date range change."""
|
"""Handle date range change."""
|
||||||
self.date_from = self.date_range_id.date_start
|
self.date_from = self.date_range_id.date_start
|
||||||
self.date_to = self.date_range_id.date_end
|
self.date_to = self.date_range_id.date_end
|
||||||
if self.date_from:
|
|
||||||
self.fy_start_date = self.env.user.company_id.find_daterange_fy(
|
|
||||||
fields.Date.from_string(self.date_range_id.date_start)
|
|
||||||
).date_start
|
|
||||||
|
|
||||||
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Author: Julien Coux
|
# Author: Julien Coux
|
||||||
# Copyright 2016 Camptocamp SA
|
# Copyright 2016 Camptocamp SA
|
||||||
|
# Copyright 2017 Akretion - Alexis de Lattre
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
|
@ -23,7 +24,7 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||||
)
|
)
|
||||||
date_from = fields.Date(required=True)
|
date_from = fields.Date(required=True)
|
||||||
date_to = fields.Date(required=True)
|
date_to = fields.Date(required=True)
|
||||||
fy_start_date = fields.Date(required=True)
|
fy_start_date = fields.Date(compute='_compute_fy_start_date')
|
||||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
||||||
('all', 'All Entries')],
|
('all', 'All Entries')],
|
||||||
string='Target Moves',
|
string='Target Moves',
|
||||||
|
@ -53,6 +54,13 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||||
string='Not only one unaffected earnings account'
|
string='Not only one unaffected earnings account'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@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 = res['date_from']
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange('company_id')
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
"""Handle company change."""
|
"""Handle company change."""
|
||||||
|
@ -69,10 +77,6 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||||
"""Handle date range change."""
|
"""Handle date range change."""
|
||||||
self.date_from = self.date_range_id.date_start
|
self.date_from = self.date_range_id.date_start
|
||||||
self.date_to = self.date_range_id.date_end
|
self.date_to = self.date_range_id.date_end
|
||||||
if self.date_from:
|
|
||||||
self.fy_start_date = self.env.user.company_id.find_daterange_fy(
|
|
||||||
fields.Date.from_string(self.date_range_id.date_start)
|
|
||||||
).date_start
|
|
||||||
|
|
||||||
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
|
|
Loading…
Reference in New Issue