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
bd4d1dc13ff0
Commit
bd4d1dc13ff0
authored
15 years ago
by
Sylvain Thénault
Browse files
Options
Downloads
Patches
Plain Diff
3.6 api update
parent
5edfac9f2469
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
entities.py
+1
-1
1 addition, 1 deletion
entities.py
views/__init__.py
+5
-5
5 additions, 5 deletions
views/__init__.py
views/accounting.py
+8
-8
8 additions, 8 deletions
views/accounting.py
views/actions.py
+2
-2
2 additions, 2 deletions
views/actions.py
with
16 additions
and
16 deletions
entities.py
+
1
−
1
View file @
bd4d1dc1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
@property
@property
def
workcase
(
self
):
def
workcase
(
self
):
rql
=
'
Any R WHERE E has_lines EL, EL eid %(el)s, E spent_for W, W ref R
'
rql
=
'
Any R WHERE E has_lines EL, EL eid %(el)s, E spent_for W, W ref R
'
rset
=
self
.
req
.
execute
(
rql
,
{
'
el
'
:
self
.
eid
})
rset
=
self
.
_cw
.
execute
(
rql
,
{
'
el
'
:
self
.
eid
}
,
'
el
'
)
if
rset
:
if
rset
:
return
rset
[
0
][
0
]
return
rset
[
0
][
0
]
return
None
return
None
This diff is collapsed.
Click to expand it.
views/__init__.py
+
5
−
5
View file @
bd4d1dc1
"""
template-specific forms/views/actions/components
"""
"""
template-specific forms/views/actions/components
"""
from
logilab.common.decorators
import
monkeypatch
from
logilab.common.decorators
import
monkeypatch
from
cubicweb.web
import
uicfg
from
cubicweb.web
import
uicfg
,
formwidgets
as
fw
from
cubicweb.web.formwidgets
import
RestrictedAutoCompletionWidget
from
cubicweb.web.views
import
basecontrollers
from
cubicweb.web.views
import
basecontrollers
_afs
=
uicfg
.
autoform_section
_afs
=
uicfg
.
autoform_section
...
@@ -6,5 +5,4 @@
...
@@ -6,5 +5,4 @@
from
cubicweb.web.views
import
basecontrollers
from
cubicweb.web.views
import
basecontrollers
_afs
=
uicfg
.
autoform_section
_afs
=
uicfg
.
autoform_section
_afs
.
tag_subject_of
((
'
Expense
'
,
'
spent_for
'
,
'
*
'
),
'
primary
'
)
_affk
=
uicfg
.
autoform_field_kwargs
_affk
=
uicfg
.
autoform_field_kwargs
...
@@ -10,2 +8,4 @@
...
@@ -10,2 +8,4 @@
_affk
=
uicfg
.
autoform_field_kwargs
_affk
=
uicfg
.
autoform_field_kwargs
_afs
.
tag_subject_of
((
'
Expense
'
,
'
spent_for
'
,
'
*
'
),
'
main
'
,
'
attributes
'
)
_afs
.
tag_subject_of
((
'
Expense
'
,
'
spent_for
'
,
'
*
'
),
'
muledit
'
,
'
attributes
'
)
_affk
.
tag_subject_of
((
'
Expense
'
,
'
spent_for
'
,
'
*
'
),
_affk
.
tag_subject_of
((
'
Expense
'
,
'
spent_for
'
,
'
*
'
),
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
_affk
.
tag_subject_of
((
'
Expense
'
,
'
spent_for
'
,
'
*
'
),
_affk
.
tag_subject_of
((
'
Expense
'
,
'
spent_for
'
,
'
*
'
),
{
'
widget
'
:
RestrictedAutoCompletionWidget
(
autocomplete_initfunc
=
'
get_concerned_by
'
)})
{
'
widget
'
:
fw
.
RestrictedAutoCompletionWidget
(
autocomplete_initfunc
=
'
get_concerned_by
'
)})
@monkeypatch
(
basecontrollers
.
JSonController
)
@monkeypatch
(
basecontrollers
.
JSonController
)
@basecontrollers.jsonize
@basecontrollers.jsonize
def
js_get_concerned_by
(
self
):
def
js_get_concerned_by
(
self
):
...
@@ -13,6 +13,6 @@
...
@@ -13,6 +13,6 @@
@monkeypatch
(
basecontrollers
.
JSonController
)
@monkeypatch
(
basecontrollers
.
JSonController
)
@basecontrollers.jsonize
@basecontrollers.jsonize
def
js_get_concerned_by
(
self
):
def
js_get_concerned_by
(
self
):
return
self
.
req
.
execute
(
'
DISTINCT Any W,R ORDERBY R WHERE W ref R
'
).
rows
return
self
.
_cw
.
execute
(
'
DISTINCT Any W,R ORDERBY R WHERE W ref R
'
).
rows
This diff is collapsed.
Click to expand it.
views/accounting.py
+
8
−
8
View file @
bd4d1dc1
...
@@ -7,10 +7,10 @@
...
@@ -7,10 +7,10 @@
__docformat__
=
"
restructuredtext en
"
__docformat__
=
"
restructuredtext en
"
from
logilab.mtconverter
import
ht
ml_escape
from
logilab.mtconverter
import
x
ml_escape
from
cubicweb.selectors
import
implements
from
cubicweb.selectors
import
implements
from
cubicweb.view
import
EntityView
from
cubicweb.view
import
EntityView
class
ExpenseAccountingXmlView
(
EntityView
):
class
ExpenseAccountingXmlView
(
EntityView
):
...
@@ -11,10 +11,10 @@
...
@@ -11,10 +11,10 @@
from
cubicweb.selectors
import
implements
from
cubicweb.selectors
import
implements
from
cubicweb.view
import
EntityView
from
cubicweb.view
import
EntityView
class
ExpenseAccountingXmlView
(
EntityView
):
class
ExpenseAccountingXmlView
(
EntityView
):
id
=
'
accexpense
'
__regid__
=
'
accexpense
'
__select__
=
implements
(
'
Expense
'
)
__select__
=
implements
(
'
Expense
'
)
title
=
_
(
'
accounting entry view
'
)
title
=
_
(
'
accounting entry view
'
)
...
@@ -22,8 +22,8 @@
...
@@ -22,8 +22,8 @@
content_type
=
'
text/xml
'
content_type
=
'
text/xml
'
def
cell_call
(
self
,
row
,
col
):
def
cell_call
(
self
,
row
,
col
):
entity
=
self
.
entity
(
row
,
col
)
entity
=
self
.
cw_rset
.
get_
entity
(
row
,
col
)
self
.
wview
(
'
accentry
'
,
entity
.
related
(
'
has_lines
'
))
self
.
wview
(
'
accentry
'
,
entity
.
related
(
'
has_lines
'
))
class
ExpenseLineAccountingEntryXmlView
(
EntityView
):
class
ExpenseLineAccountingEntryXmlView
(
EntityView
):
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
self
.
wview
(
'
accentry
'
,
entity
.
related
(
'
has_lines
'
))
self
.
wview
(
'
accentry
'
,
entity
.
related
(
'
has_lines
'
))
class
ExpenseLineAccountingEntryXmlView
(
EntityView
):
class
ExpenseLineAccountingEntryXmlView
(
EntityView
):
id
=
'
accentry
'
__regid__
=
'
accentry
'
__select__
=
implements
(
'
ExpenseLine
'
,)
__select__
=
implements
(
'
ExpenseLine
'
,)
title
=
_
(
'
accounting entry view
'
)
title
=
_
(
'
accounting entry view
'
)
...
@@ -37,5 +37,5 @@
...
@@ -37,5 +37,5 @@
def
call
(
self
):
def
call
(
self
):
"""
display a list of entities by calling their <item_vid> view
"""
display a list of entities by calling their <item_vid> view
"""
"""
self
.
w
(
u
'
<?xml version=
"
1.0
"
encoding=
"
%s
"
?>
\n
'
%
self
.
req
.
encoding
)
self
.
w
(
u
'
<?xml version=
"
1.0
"
encoding=
"
%s
"
?>
\n
'
%
self
.
_cw
.
encoding
)
self
.
w
(
u
'
<ecritures>
\n
'
)
self
.
w
(
u
'
<ecritures>
\n
'
)
...
@@ -41,6 +41,6 @@
...
@@ -41,6 +41,6 @@
self
.
w
(
u
'
<ecritures>
\n
'
)
self
.
w
(
u
'
<ecritures>
\n
'
)
for
i
in
xrange
(
self
.
rset
.
rowcount
):
for
i
in
xrange
(
self
.
cw_
rset
.
rowcount
):
self
.
cell_call
(
i
,
0
)
self
.
cell_call
(
i
,
0
)
self
.
w
(
u
'
</ecritures>
\n
'
)
self
.
w
(
u
'
</ecritures>
\n
'
)
def
cell_call
(
self
,
row
,
col
):
def
cell_call
(
self
,
row
,
col
):
...
@@ -43,6 +43,6 @@
...
@@ -43,6 +43,6 @@
self
.
cell_call
(
i
,
0
)
self
.
cell_call
(
i
,
0
)
self
.
w
(
u
'
</ecritures>
\n
'
)
self
.
w
(
u
'
</ecritures>
\n
'
)
def
cell_call
(
self
,
row
,
col
):
def
cell_call
(
self
,
row
,
col
):
entity
=
self
.
complete_entity
(
row
,
col
)
entity
=
self
.
cw_rset
.
complete_entity
(
row
,
col
)
self
.
w
(
u
'
<ecriture date=
"
%s
"
>
\n
'
%
entity
.
diem
.
strftime
(
'
%Y-%m-%d
'
))
self
.
w
(
u
'
<ecriture date=
"
%s
"
>
\n
'
%
entity
.
diem
.
strftime
(
'
%Y-%m-%d
'
))
...
@@ -48,5 +48,5 @@
...
@@ -48,5 +48,5 @@
self
.
w
(
u
'
<ecriture date=
"
%s
"
>
\n
'
%
entity
.
diem
.
strftime
(
'
%Y-%m-%d
'
))
self
.
w
(
u
'
<ecriture date=
"
%s
"
>
\n
'
%
entity
.
diem
.
strftime
(
'
%Y-%m-%d
'
))
self
.
w
(
u
'
<libelle>%s</libelle>
\n
'
%
ht
ml_escape
(
entity
.
dc_long_title
()))
self
.
w
(
u
'
<libelle>%s</libelle>
\n
'
%
x
ml_escape
(
entity
.
dc_long_title
()))
amount
=
round
(
entity
.
euro_amount
(),
2
)
amount
=
round
(
entity
.
euro_amount
(),
2
)
taxes
=
round
(
entity
.
taxes
,
2
)
taxes
=
round
(
entity
.
taxes
,
2
)
self
.
w
(
u
'
<credit compte=
"
%s
"
montant=
"
%.2f
"
/>
\n
'
%
(
self
.
w
(
u
'
<credit compte=
"
%s
"
montant=
"
%.2f
"
/>
\n
'
%
(
...
...
This diff is collapsed.
Click to expand it.
views/actions.py
+
2
−
2
View file @
bd4d1dc1
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
from
cubicweb.web.action
import
Action
from
cubicweb.web.action
import
Action
class
AccountingAction
(
Action
):
class
AccountingAction
(
Action
):
id
=
'
accaction
'
__regid__
=
'
accaction
'
__select__
=
implements
(
'
Expense
'
)
__select__
=
implements
(
'
Expense
'
)
title
=
_
(
'
generate accounting entries
'
)
title
=
_
(
'
generate accounting entries
'
)
def
url
(
self
):
def
url
(
self
):
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
__select__
=
implements
(
'
Expense
'
)
__select__
=
implements
(
'
Expense
'
)
title
=
_
(
'
generate accounting entries
'
)
title
=
_
(
'
generate accounting entries
'
)
def
url
(
self
):
def
url
(
self
):
entity
=
self
.
entity
(
0
,
0
)
entity
=
self
.
cw_rset
.
get_entity
(
self
.
cw_row
or
0
,
self
.
cw_col
or
0
)
return
entity
.
absolute_url
(
vid
=
'
accexpense
'
)
return
entity
.
absolute_url
(
vid
=
'
accexpense
'
)
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