Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fresh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
cubicweb
cubes
fresh
Commits
989f05cf876e
Commit
989f05cf876e
authored
15 years ago
by
Sylvain Thénault
Browse files
Options
Downloads
Patches
Plain Diff
fix xml accounting views so they pass tests
parent
1ee82b460998
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
views/accounting.py
+20
-7
20 additions, 7 deletions
views/accounting.py
with
20 additions
and
7 deletions
views/accounting.py
+
20
−
7
View file @
989f05cf
"""
accounting views for fresh template
:organization: Logilab
:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:copyright: 2008
-2010
LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__
=
"
restructuredtext en
"
...
...
@@ -21,5 +21,14 @@
templatable
=
False
content_type
=
'
text/xml
'
def
call
(
self
):
"""
display a list of entities by calling their <item_vid> view
"""
self
.
w
(
u
'
<?xml version=
"
1.0
"
encoding=
"
%s
"
?>
\n
'
%
self
.
_cw
.
encoding
)
self
.
w
(
u
'
<ecritures>
\n
'
)
for
i
in
xrange
(
self
.
cw_rset
.
rowcount
):
self
.
cell_call
(
i
,
0
)
self
.
w
(
u
'
</ecritures>
\n
'
)
def
cell_call
(
self
,
row
,
col
):
entity
=
self
.
cw_rset
.
get_entity
(
row
,
col
)
...
...
@@ -24,6 +33,8 @@
def
cell_call
(
self
,
row
,
col
):
entity
=
self
.
cw_rset
.
get_entity
(
row
,
col
)
self
.
wview
(
'
accentry
'
,
entity
.
related
(
'
has_lines
'
))
rset
=
entity
.
related
(
'
has_lines
'
)
for
i
in
xrange
(
len
(
rset
)):
self
.
wview
(
'
accentry
'
,
rset
,
row
=
i
,
col
=
0
)
class
ExpenseLineAccountingEntryXmlView
(
EntityView
):
...
...
@@ -49,8 +60,9 @@
self
.
w
(
u
'
<libelle>%s</libelle>
\n
'
%
xml_escape
(
entity
.
dc_long_title
()))
amount
=
round
(
entity
.
euro_amount
(),
2
)
taxes
=
round
(
entity
.
taxes
,
2
)
self
.
w
(
u
'
<credit compte=
"
%s
"
montant=
"
%.2f
"
/>
\n
'
%
(
entity
.
paid_by
[
0
].
account
,
amount
))
account
=
entity
.
paid_by
[
0
].
account
and
xml_escape
(
entity
.
paid_by
[
0
].
account
)
or
u
''
self
.
w
(
u
'
<credit compte=
"
%s
"
montant=
"
%.2f
"
/>
\n
'
%
(
account
,
amount
))
if
entity
.
taxes
:
# XXX hardcoded account for VAT
self
.
w
(
u
'
<debit compte=
"
44566
"
montant=
"
%.2f
"
/>
\n
'
%
entity
.
taxes
)
...
...
@@ -64,6 +76,7 @@
debit_remainder
-=
1
else
:
debit
=
debit_quotient
/
100.0
self
.
w
(
u
'
<debit compte=
"
%s
"
montant=
"
%.2f
"
/>
\n
'
%
(
account
.
account
,
debit
))
account
=
account
.
account
and
xml_escape
(
account
.
account
)
or
u
''
self
.
w
(
u
'
<debit compte=
"
%s
"
montant=
"
%.2f
"
/>
\n
'
%
(
account
,
debit
))
if
entity
.
workcase
:
...
...
@@ -69,4 +82,4 @@
if
entity
.
workcase
:
self
.
w
(
u
'
<groupe>%s</groupe>
\n
'
%
entity
.
workcase
)
self
.
w
(
u
'
<groupe>%s</groupe>
\n
'
%
xml_escape
(
entity
.
workcase
)
)
self
.
w
(
u
'
</ecriture>
\n
'
)
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