[IMP] account: add compute_fiscalyear_dates method on res.company
[IMP] account: add compute_fiscalyear_dates method on res.company The following commits https://github.com/odoo/odoo/commit/576a69e29e98532aa5de78eb3fcbff0b94cea32d https://github.com/odoo-dev/enterprise/commit/ed383522791276b17ba68a4f0d08f9e3ed4e783c move the compute_fiscalyear_dates method from the community account module to the enterprise one account_accounting. This commit ensures that the method can be used when account_accounting is not installed. As the fiscal year is irrelevant when account_accounting is not installed, this commit displays the calendar year. taskid: 2329108 See also: taskid 220194 closes odoo/odoo#60140 X-original-commit: 544cb3682033e9f644b48b97dd5197eaf9282ff5 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -544,3 +544,16 @@ class ResCompany(models.Model):
|
||||
results_by_journal['results'].append(rslt)
|
||||
|
||||
return results_by_journal
|
||||
|
||||
def compute_fiscalyear_dates(self, current_date):
|
||||
"""
|
||||
The role of this method is to provide a fallback when account_accounting is not installed.
|
||||
As the fiscal year is irrelevant when account_accounting is not installed, this method returns the calendar year.
|
||||
:param current_date: A datetime.date/datetime.datetime object.
|
||||
:return: A dictionary containing:
|
||||
* date_from
|
||||
* date_to
|
||||
"""
|
||||
|
||||
return {'date_from': datetime(year=current_date.year, month=1, day=1).date(),
|
||||
'date_to': datetime(year=current_date.year, month=12, day=31).date()}
|
||||
|
||||
Reference in New Issue
Block a user