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
Commits
28cca3ef7c26
Commit
28cca3ef7c26
authored
4 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Users may set accounting dates in advance
parent
115dd1756551
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Topic/13.0/dates tg 347
Pipeline
#11710
canceled
4 years ago
Stage: build
Stage: test
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
NEWS.rst
+5
-0
5 additions, 0 deletions
NEWS.rst
README.rst
+2
-0
2 additions, 0 deletions
README.rst
__manifest__.py
+1
-1
1 addition, 1 deletion
__manifest__.py
models/account_move.py
+3
-4
3 additions, 4 deletions
models/account_move.py
tests/test_account_period.py
+27
-1
27 additions, 1 deletion
tests/test_account_period.py
with
38 additions
and
6 deletions
NEWS.rst
+
5
−
0
View file @
28cca3ef
13.0.1.1.0
----------
* Users may set accounting dates in advance.
13.0.1.0.0
----------
...
...
This diff is collapsed.
Click to expand it.
README.rst
+
2
−
0
View file @
28cca3ef
...
...
@@ -12,6 +12,8 @@
:alt: coverage report
Per-period accounting concept. Periods can be individually closed.
Periods are filled based on an accounting date this module adds which users
may however set in advance.
This module also adds a transaction date in accounting documents.
...
...
This diff is collapsed.
Click to expand it.
__manifest__.py
+
1
−
1
View file @
28cca3ef
...
...
@@ -22,7 +22,7 @@
"
name
"
:
"
Accounting Periods
"
,
"
license
"
:
"
AGPL-3
"
,
"
summary
"
:
"
Add period accounting concept
"
,
"
version
"
:
"
13.0.1.
0
.0
"
,
"
version
"
:
"
13.0.1.
1
.0
"
,
"
category
"
:
"
Accounting/Accounting
"
,
"
author
"
:
"
XCG Consulting
"
,
"
website
"
:
"
http://odoo.consulting/
"
,
...
...
This diff is collapsed.
Click to expand it.
models/account_move.py
+
3
−
4
View file @
28cca3ef
...
...
@@ -18,8 +18,6 @@
#
##############################################################################
import
datetime
from
odoo
import
_
,
api
,
exceptions
,
fields
,
models
...
...
@@ -33,7 +31,7 @@
string
=
"
Accounting date
"
,
copy
=
False
,
help
=
"
Validation date of the accounting document.
"
,
readonly
=
True
,
states
=
{
"
posted
"
:
[(
"
readonly
"
,
True
)]}
,
)
period_id
=
fields
.
Many2one
(
...
...
@@ -82,8 +80,8 @@
- Only select open periods.
"""
acc_date
=
datetime
.
d
ate
.
today
()
today
=
fields
.
D
ate
.
today
()
for
accdoc
in
self
:
# Cache some data.
...
...
@@ -86,7 +84,8 @@
for
accdoc
in
self
:
# Cache some data.
acc_date
=
accdoc
.
accounting_date
or
today
company
=
accdoc
.
company_id
# Set the acc_date only if the force_period_on_date
...
...
This diff is collapsed.
Click to expand it.
tests/test_account_period.py
+
27
−
1
View file @
28cca3ef
...
...
@@ -51,6 +51,18 @@
today
=
odoo
.
fields
.
Date
.
today
()
period_today
=
self
.
_getTodayPeriod
()
# Prepare periods for the 2017-01-15 date we use below.
fiscalyear_2017
=
self
.
env
[
"
account.fiscalyear
"
].
create
(
{
"
code
"
:
"
2017
"
,
"
company_id
"
:
self
.
env
.
company
.
id
,
"
date_stop
"
:
odoo
.
fields
.
Date
.
to_date
(
"
2017-12-31
"
),
"
name
"
:
"
2017
"
,
}
)
fiscalyear_2017
.
create_period
()
period_2017_01
=
fiscalyear_2017
.
period_ids
[
0
]
# Control: Default dates & period around today.
accdoc
=
self
.
_makeInvoice
()
self
.
_validateInvoice
(
accdoc
)
...
...
@@ -62,7 +74,7 @@
self
.
assertEqual
(
set
(
accentries
.
mapped
(
"
transaction_date
"
)),
{
today
})
self
.
assertEqual
(
accentries
.
mapped
(
"
period_id
"
).
id
,
period_today
.
id
)
# Force a date on the invoice; check its propagation.
# Force a
transaction
date on the invoice; check its propagation.
forced_date
=
odoo
.
fields
.
Date
.
to_date
(
"
2017-01-15
"
)
accdoc
=
self
.
_makeInvoice
(
invoice_date
=
forced_date
)
self
.
_validateInvoice
(
accdoc
)
...
...
@@ -76,6 +88,20 @@
)
self
.
assertEqual
(
accentries
.
mapped
(
"
period_id
"
).
id
,
period_today
.
id
)
# Force an accounting date on the invoice; check its propagation.
forced_date
=
odoo
.
fields
.
Date
.
to_date
(
"
2017-01-15
"
)
accdoc
=
self
.
_makeInvoice
(
accounting_date
=
forced_date
)
self
.
_validateInvoice
(
accdoc
)
self
.
assertEqual
(
accdoc
.
accounting_date
,
forced_date
)
self
.
assertEqual
(
accdoc
.
date
,
today
)
# unchanged odoo field
self
.
assertEqual
(
accdoc
.
transaction_date
,
forced_date
)
self
.
assertEqual
(
accdoc
.
period_id
.
id
,
period_2017_01
.
id
)
accentries
=
accdoc
.
line_ids
self
.
assertEqual
(
set
(
accentries
.
mapped
(
"
transaction_date
"
)),
{
forced_date
}
)
self
.
assertEqual
(
accentries
.
mapped
(
"
period_id
"
).
id
,
period_2017_01
.
id
)
def
test_close_period
(
self
):
"""
Check the
"
Close period
"
dialog box.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment