Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Cédric Le Ninivin
slapos.core
Commits
f140191f
Commit
f140191f
authored
May 20, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_ui_test: Generate proper invoice for the test.
parent
25b64857
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
10 deletions
+55
-10
master/bt5/slapos_jio_ui_test/SkinTemplateItem/portal_skins/slapos_ui_test/ERP5Site_createSlapOSFakeInvoiceForTestUser.py
...os_ui_test/ERP5Site_createSlapOSFakeInvoiceForTestUser.py
+55
-10
No files found.
master/bt5/slapos_jio_ui_test/SkinTemplateItem/portal_skins/slapos_ui_test/ERP5Site_createSlapOSFakeInvoiceForTestUser.py
View file @
f140191f
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
accounting_module
=
portal
.
accounting_module
portal_membership
=
portal
.
portal_membership
demo_user_functional
=
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
demo_user_functional
=
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
def
wrapWithShadow
():
payment_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentTemplate
())
payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
for
line
in
payment
.
contentValues
():
if
line
.
getSource
()
==
"account_module/payment_to_encash"
:
line
.
setQuantity
(
-
1
)
elif
line
.
getSource
()
==
"account_module/receivable"
:
line
.
setQuantity
(
1
)
payment
.
confirm
()
payment
.
start
()
payment
.
stop
()
payment
.
PaymentTransaction_generatePayzenId
()
template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate
())
current_invoice
=
template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_invoice
.
edit
(
destination_value
=
demo_user_functional
,
destination_section_value
=
demo_user_functional
,
destination_decision_value
=
demo_user_functional
,
start_date
=
DateTime
(
'2019/10/20'
),
stop_date
=
DateTime
(
'2019/10/20'
),
title
=
'Fake Invoice for Demo User Functional'
,
price_currency
=
"currency_module/EUR"
,
reference
=
'1'
)
cell
=
current_invoice
[
"1"
][
"movement_0"
]
cell
.
edit
(
variation
=
current_invoice
[
"1"
].
getVariation
(),
quantity
=
1
)
cell
.
setPrice
(
1
)
return
current_invoice
,
payment
current_invoice
,
payment
=
demo_user_functional
.
Person_restrictMethodAsShadowUser
(
shadow_document
=
demo_user_functional
,
callable_object
=
wrapWithShadow
,
argument_list
=
[])
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'Fake Invoice for Demo User Functional'
,
simulation_state
=
'delivered'
,
reference
=
'1'
,
destination_section_value
=
demo_user_functional
,
start_date
=
DateTime
(
'2019/10/20'
),
)
payment
.
setCausalityValue
(
current_invoice
)
current_invoice
.
plan
()
current_invoice
.
confirm
()
current_invoice
.
startBuilding
()
current_invoice
.
reindexObject
()
current_invoice
.
stop
()
return
'Done.'
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