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
Léo-Paul Géneau
slapos.core
Commits
27dab6a3
Commit
27dab6a3
authored
Mar 08, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Use price definiton from sale supply rather them the line
parent
7171eb27
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
18 deletions
+29
-18
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createRelatedSaleInvoiceTransaction.py
...ubscriptionRequest_createRelatedSaleInvoiceTransaction.py
+4
-11
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createRelatedSaleInvoiceTransaction.xml
...bscriptionRequest_createRelatedSaleInvoiceTransaction.xml
+1
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.py
..._request/SubscriptionRequest_requestPaymentTransaction.py
+24
-6
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createRelatedSaleInvoiceTransaction.py
View file @
27dab6a3
...
...
@@ -3,20 +3,14 @@ if REQUEST is not None:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
current_invoice
=
context
.
getCausalityValue
()
if
current_invoice
is
None
:
if
target_language
==
"zh"
:
# Wechat payment
invoice_template_path
=
portal
.
portal_preferences
.
getPreferredZhPrePaymentSubscriptionInvoiceTemplate
()
else
:
invoice_template_path
=
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate
()
invoice_template
=
portal
.
restrictedTraverse
(
invoice_template_path
)
invoice_template
=
portal
.
restrictedTraverse
(
template
)
current_invoice
=
invoice_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
context
.
edit
(
causality_value
=
current_invoice
)
payment_transaction
=
invoice_template
=
portal
.
restrictedTraverse
(
payment
)
payment_transaction
=
portal
.
restrictedTraverse
(
payment
)
current_invoice
.
edit
(
title
=
"Reservation Fee"
,
destination_value
=
context
.
getDestinationSection
(),
...
...
@@ -25,9 +19,8 @@ if current_invoice is None:
start_date
=
payment_transaction
.
getStartDate
(),
stop_date
=
payment_transaction
.
getStopDate
(),
)
if
not
amount
:
# this is supposed to be free, so turn price free.
current_invoice
[
"1"
].
setPrice
(
0.0
)
current_invoice
[
"1"
].
setPrice
(
price
)
current_invoice
[
"1"
].
setQuantity
(
context
.
getQuantity
())
comment
=
"Validation invoice for subscription request %s"
%
context
.
getRelativeUrl
()
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createRelatedSaleInvoiceTransaction.xml
View file @
27dab6a3
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
amount, tag, payment, target_languag
e, REQUEST=None
</string>
</value>
<value>
<string>
price, tag, payment, templat
e, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.py
View file @
27dab6a3
...
...
@@ -10,10 +10,12 @@ current_payment = None
if
current_invoice
is
None
:
if
target_language
==
"zh"
:
# Wechat payment, reservation fee is 188 CNY
payment_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredZhPrePaymentTemplate
())
invoice_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredZhPrePaymentSubscriptionInvoiceTemplate
())
else
:
# Payzen payment, reservation fee is 25 EUR
payment_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentTemplate
())
current_payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
invoice_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate
()
)
current_payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_payment
.
edit
(
title
=
"Payment for Reservation Fee"
,
destination_value
=
context
.
getDestinationSection
(),
...
...
@@ -26,12 +28,28 @@ if current_invoice is None:
amount
=
context
.
getQuantity
()
if
context
.
SubscriptionRequest_testSkippedReservationFree
(
contract
):
# Reservation is Free
amount
=
0
price
=
0
tax
=
0
else
:
invoice_line
=
invoice_template
[
"1"
].
asContext
()
price
=
invoice_line
.
getResourceValue
().
getPrice
(
context
=
invoice_line
)
# We need to provide Price to pay right the way, so we need to include
# taxation at this point it is most liketly to quickly forecast price
# with taxes, but for now it is hardcoded.
tax
=
0
if
'base_amount/invoicing/taxable'
in
invoice_line
.
getBaseContributionList
():
tax
=
0.2
for
line
in
current_payment
.
contentValues
():
if
line
.
getSource
()
in
[
"account_module/payment_to_encash"
,
"account_module/receivable"
]:
quantity
=
int
(
amount
)
*
line
.
getQuantity
()
line
.
setQuantity
(
quantity
)
if
line
.
getSource
()
==
"account_module/payment_to_encash"
:
total
=
round
((
-
int
(
amount
)
*
price
)
+
(
-
int
(
amount
)
*
price
*
tax
),
2
)
line
.
setQuantity
(
total
)
elif
line
.
getSource
()
==
"account_module/receivable"
:
total
=
round
((
int
(
amount
)
*
price
)
+
(
int
(
amount
)
*
price
*
tax
),
2
)
line
.
setQuantity
(
total
)
# Accelarate job of alarms before proceed to payment.
comment
=
"Validation payment for subscription request %s"
%
context
.
getRelativeUrl
()
...
...
@@ -46,6 +64,6 @@ if current_invoice is None:
context
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
context
.
activate
(
tag
=
tag
).
SubscriptionRequest_createRelatedSaleInvoiceTransaction
(
amount
,
tag
,
current_payment
.
getRelativeUrl
(),
target_language
)
price
,
tag
,
current_payment
.
getRelativeUrl
(),
invoice_template
.
getRelativeUrl
()
)
return
current_payment
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