Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hugo Ricateau
erp5
Commits
4aad72e4
Commit
4aad72e4
authored
Jan 24, 2017
by
Cédric Le Ninivin
Committed by
Xiaowu Zhang
Jan 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_travel_expense: Fix Creation of transaction to respect accounting constraints
parent
a7db5bb3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_createPurchaseTransaction.py
...est/ExpenseValidationRequest_createPurchaseTransaction.py
+22
-0
bt5/erp5_travel_expense/WorkflowTemplateItem/portal_workflow/expense_validation_request_interaction_workflow/interactions/ExpenseValidationRequest_accept.xml
...workflow/interactions/ExpenseValidationRequest_accept.xml
+5
-7
No files found.
bt5/erp5_travel_expense/SkinTemplateItem/portal_skins/erp5_hr_request/ExpenseValidationRequest_createPurchaseTransaction.py
View file @
4aad72e4
...
...
@@ -23,6 +23,7 @@ transaction = portal.accounting_module.newContent(
resource
=
context
.
getPriceCurrency
(),
created_by_builder
=
1
,
# XXX this prevent init script from creating lines.
start_date
=
context
.
getStartDate
(),
stop_date
=
context
.
getStartDate
(),
causality
=
context
.
getRelativeUrl
(),
)
...
...
@@ -38,6 +39,27 @@ transaction.newContent(
quantity
=
(
-
float
(
context
.
getTotalPrice
())),
)
from
Products.DCWorkflow.DCWorkflow
import
ValidationFailed
from
zExceptions
import
Redirect
try
:
transaction
.
Base_checkConsistency
()
except
ValidationFailed
,
error_message
:
if
getattr
(
error_message
,
'msg'
,
None
):
# use of Message class to store message+mapping+domain
message
=
error_message
.
msg
if
same_type
(
message
,
[]):
message
=
'. '
.
join
(
'%s'
%
x
for
x
in
message
)
else
:
message
=
str
(
message
)
else
:
message
=
str
(
error_message
)
if
len
(
message
)
>
2000
:
# too long message will generate a too long URI
# that would become an error.
message
=
"%s ..."
%
message
[:(
2000
-
4
)]
raise
Redirect
,
"%s?portal_status_message=%s"
%
(
context
.
getAbsoluteUrl
(),
message
)
transaction
.
stop
()
return
transaction
.
getRelativeUrl
()
bt5/erp5_travel_expense/WorkflowTemplateItem/portal_workflow/expense_validation_request_interaction_workflow/interactions/ExpenseValidationRequest_accept.xml
View file @
4aad72e4
...
...
@@ -27,15 +27,15 @@
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<list>
<string>
ExpenseValidationRequest_accept
</string>
</list>
<tuple/>
</value>
</item>
<item>
<key>
<string>
before_commit_script_name
</string>
</key>
<value>
<tuple/>
<list>
<string>
ExpenseValidationRequest_accept
</string>
</list>
</value>
</item>
<item>
...
...
@@ -67,9 +67,7 @@
<item>
<key>
<string>
portal_type_filter
</string>
</key>
<value>
<list>
<string>
Expense Validation Request
</string>
</list>
<none/>
</value>
</item>
<item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment