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
!40
16.0.1.3.0 - Fix period selection upon reversal with a specific date + QoL
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
16.0.1.3.0 - Fix period selection upon reversal with a specific date + QoL
topic/16.0/zouzou
into
branch/16.0
Overview
0
Commits
2
Pipelines
1
Changes
5
Merged
Houzefa Abbasbhay
requested to merge
topic/16.0/zouzou
into
branch/16.0
1 year ago
Overview
0
Commits
2
Pipelines
1
Changes
5
Expand
0
0
Merge request reports
Compare
branch/16.0
branch/16.0 (base)
and
latest version
latest version
678e81bf
2 commits,
1 year ago
5 files
+
79
−
55
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
models/account_move.py
+
9
−
8
Options
@@ -17,12 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from
odoo
import
fields
,
models
class
AccountMove
(
models
.
Model
):
"""
Add
a
period
& dates onto accounting documents
.
"""
"""
Journal Entries:
Add period
, filled based on date
.
"""
_inherit
=
"
account.move
"
@@ -30,18 +29,20 @@ class AccountMove(models.Model):
comodel_name
=
"
account.period
"
,
string
=
"
Period
"
,
ondelete
=
"
restrict
"
,
copy
=
False
,
# Do not copy; will be reset upon validation.
help
=
"
The period this accounting document is in.
"
,
index
=
True
,
states
=
{
"
posted
"
:
[(
"
readonly
"
,
True
),
(
"
required
"
,
True
)]},
)
def
action
_post
(
self
):
"""
Override
accounting document
validation to fill period.
"""
self
.
fill_period
()
return
super
().
action_post
()
def
_post
(
self
,
soft
=
True
):
"""
Override validation to fill period.
"""
ret
=
super
().
_post
(
soft
=
soft
)
self
.
filtered
(
lambda
move
:
move
.
state
==
"
posted
"
).
fill_period
()
return
ret
def
fill_period
(
self
):
"""
Find an open period around move date, set it onto
that
move.
"""
"""
Find an open period around move date, set it onto
each
move.
"""
today
=
fields
.
Date
.
context_today
(
self
)
for
accdoc
in
self
:
Loading