Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
24
account_move_fiscal_year/models/res_company.py
Executable file
24
account_move_fiscal_year/models/res_company.py
Executable file
@@ -0,0 +1,24 @@
|
||||
# Author: Damien Crier
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = "res.company"
|
||||
|
||||
def find_daterange_fy(self, date):
|
||||
"""
|
||||
try to find a date range with type 'fiscalyear'
|
||||
with @param:date contained in its date_start/date_end interval
|
||||
"""
|
||||
fiscalyear = self.env["account.fiscal.year"].search(
|
||||
[
|
||||
("company_id", "=", self.id),
|
||||
("date_from", "<=", date),
|
||||
("date_to", ">=", date),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
|
||||
return fiscalyear
|
||||
Reference in New Issue
Block a user