Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Accounting Reports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Model registry
Operate
Terraform modules
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 Reports
Merge requests
!32
Enable mass validation of monthly statements.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Enable mass validation of monthly statements.
topic/11.0/TG-5326
into
branch/11.0
Overview
0
Commits
1
Pipelines
7
Changes
6
Merged
Etienne Ferriere
requested to merge
topic/11.0/TG-5326
into
branch/11.0
6 months ago
Overview
0
Commits
1
Pipelines
7
Changes
1
Expand
--HG-- branch : 11.0
0
0
Merge request reports
Compare
version 1
version 6
d57b33e7
6 months ago
version 5
c1974a52
6 months ago
version 4
c16ace45
6 months ago
version 3
55574f89
6 months ago
version 2
28671122
6 months ago
version 1
2ee24fb0
6 months ago
branch/11.0 (base)
and
version 3
latest version
3ba3d0ad
1 commit,
6 months ago
version 6
d57b33e7
1 commit,
6 months ago
version 5
c1974a52
1 commit,
6 months ago
version 4
c16ace45
1 commit,
6 months ago
version 3
55574f89
1 commit,
6 months ago
version 2
28671122
1 commit,
6 months ago
version 1
2ee24fb0
1 commit,
6 months ago
Show latest version
1 file
+
68
−
15
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
tests/test_account_report.py
+
68
−
15
Options
@@ -182,7 +182,7 @@
def
test_monthly_statement
(
self
):
"""
Test monthly statements: reports & emails.
"""
# Fe
c
th an user from the security group 'account.group_account_invoice'
# Fet
c
h an user from the security group 'account.group_account_invoice'
account_user
=
self
.
env
.
ref
(
"
account_report.account_user_demo
"
)
partner
=
self
.
env
.
ref
(
"
base.res_partner_10
"
)
@@ -193,15 +193,4 @@
)
self
.
assertEqual
(
len
(
line_to_pay
),
1
)
def
launchMonthlyStatement
():
dlg
=
self
.
env
[
"
account.monthly_statement.gen
"
].
create
(
{
"
begin_date
"
:
odoo
.
fields
.
Date
.
today
(),
"
end_date
"
:
odoo
.
fields
.
Date
.
today
(),
}
)
dlg_ret
=
dlg
.
launch
()
# "domain": [("id", "in", batches.ids)],
batch_ids
=
dlg_ret
[
"
domain
"
][
0
][
2
]
return
batch_ids
# First run: No batches as partner not set up for monthly statements.
@@ -207,5 +196,5 @@
# First run: No batches as partner not set up for monthly statements.
self
.
assertFalse
(
launchMonthlyStatement
())
self
.
assertFalse
(
self
.
_
launchMonthlyStatement
())
# Configure the partner for monthly statements.
partner
.
has_monthly_statements
=
True
@@ -214,7 +203,7 @@
)
# Run again; this now finds the invoice built above.
batch_ids
=
launchMonthlyStatement
()
batch_ids
=
self
.
_
launchMonthlyStatement
()
self
.
assertEqual
(
len
(
batch_ids
),
1
)
batch
=
self
.
env
[
"
account.monthly_statement
"
].
browse
(
batch_ids
[
0
])
self
.
assertEqual
(
batch
.
account_move_line_count
,
1
)
@@ -223,7 +212,6 @@
self
.
assertEqual
(
batch
.
state
,
"
draft
"
)
batch
.
with_context
(
user
=
account_user
.
id
).
validate
()
self
.
assertEqual
(
batch
.
state
,
"
in_progress
"
)
# Run queued job to process the batch.
@@ -243,6 +231,71 @@
self
.
assertEqual
(
line_action
[
"
domain
"
][
0
][
2
],
line_to_pay
.
ids
)
self
.
assertEqual
(
line_action
[
"
res_model
"
],
"
account.move.line
"
)
def
test_monthly_statement_mass_validation
(
self
):
"""
Test monthly statements: Mass validation.
"""
for
partner
in
(
self
.
env
.
ref
(
"
base.res_partner_7
"
)
|
self
.
env
.
ref
(
"
base.res_partner_8
"
)
|
self
.
env
.
ref
(
"
base.res_partner_9
"
)
):
invoice
=
self
.
_makeInvoice
(
partner
)
self
.
_validateInvoices
(
invoice
)
line_to_pay
=
invoice
.
move_id
.
line_ids
.
filtered
(
lambda
line
:
line
.
account_id
.
internal_type
==
"
receivable
"
)
self
.
assertEqual
(
len
(
line_to_pay
),
1
)
# Configure the partner for monthly statements.
partner
.
has_monthly_statements
=
True
partner
.
monthly_statement_kind_id
=
self
.
env
.
ref
(
"
account_report.monthly_statement_kind_1
"
)
# Run again; this now finds the invoice built above.
batch_ids
=
self
.
_launchMonthlyStatement
()
self
.
assertEqual
(
len
(
batch_ids
),
3
)
batches
=
self
.
env
[
"
account.monthly_statement
"
].
browse
(
batch_ids
)
for
batch
in
batches
:
self
.
assertEqual
(
batch
.
account_move_line_count
,
1
)
self
.
assertEqual
(
batch
.
account_move_line_ids
,
line_to_pay
)
self
.
assertAlmostEqual
(
batch
.
amount
,
AMOUNT
)
self
.
assertEqual
(
batch
.
state
,
"
draft
"
)
server_action
=
self
.
env
.
ref
(
"
account_report.
"
"
account_monthly_statement_mass_validate_server_action
"
)
server_action
.
with_context
(
active_ids
=
batch_ids
).
run
()
self
.
assertTrue
(
all
(
batches
.
mapped
(
lambda
r
:
r
.
state
==
"
in_progress
"
))
)
# Run queued job to process the batches.
for
job
in
batches
.
mapped
(
"
queue_job_ids
"
):
self
.
_runQueuedJob
(
job
)
batches
.
refresh
()
self
.
assertTrue
(
all
(
batches
.
mapped
(
lambda
r
:
r
.
state
==
"
done
"
)))
with
self
.
assertRaises
(
odoo
.
exceptions
.
UserError
):
server_action
.
with_context
(
active_ids
=
batch_ids
).
run
()
def
_launchMonthlyStatement
(
self
):
"""
Create montly statements.
"""
dlg
=
self
.
env
[
"
account.monthly_statement.gen
"
].
create
(
{
"
begin_date
"
:
odoo
.
fields
.
Date
.
today
(),
"
end_date
"
:
odoo
.
fields
.
Date
.
today
(),
}
)
dlg_ret
=
dlg
.
launch
()
# "domain": [("id", "in", batches.ids)],
batch_ids
=
dlg_ret
[
"
domain
"
][
0
][
2
]
return
batch_ids
def
_consult_account
(
self
,
account
,
**
kwargs
):
"""
Consult the specified account; return extracted accounting entries.
Loading