Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Accounting Periods
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Accounting Periods
Merge requests
!39
Draft: Add find() method on fiscal years needed by other modules.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Draft: Add find() method on fiscal years needed by other modules.
topic/16.0/MO16-00581
into
branch/16.0
Overview
0
Commits
1
Pipelines
10
Changes
4
Open
Etienne Ferriere
requested to merge
topic/16.0/MO16-00581
into
branch/16.0
1 year ago
Overview
0
Commits
1
Pipelines
10
Changes
4
Expand
MO16-00581
Edited
1 year ago
by
Vincent Hatakeyama
0
0
Merge request reports
Viewing commit
b0ee4384
Show latest version
4 files
+
64
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
b0ee4384
Add find() method on fiscal years needed by other modules.
· b0ee4384
Etienne Ferriere
authored
1 year ago
models/account_fiscal_year.py
+
21
−
0
Options
@@ -86,3 +86,24 @@ class OCAAccountFiscalyear(models.Model):
for
period
in
periods
:
period
.
unlink
()
return
super
().
unlink
()
def
find
(
self
,
date
=
None
):
"""
:param date: date (odoo format so string), if None, use today
:return: fiscal years that include the indicated date, using either
the company_id in the context or if not set, the user company_id
"""
if
not
date
:
date
=
fields
.
Date
.
context_today
(
self
)
company_id
=
self
.
env
.
context
.
get
(
"
company_id
"
)
or
self
.
env
.
company
.
id
result
=
self
.
search
(
[
(
"
date_from
"
,
"
<=
"
,
date
),
(
"
date_to
"
,
"
>=
"
,
date
),
(
"
company_id
"
,
"
=
"
,
company_id
),
],
limit
=
1
,
)
return
result
Loading