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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
f5321a6d
Commit
f5321a6d
authored
Jul 19, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_advanced_ecommerce: handle multiple tax
parent
530fabec
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
725 additions
and
13 deletions
+725
-13
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_editPersonalInformation.py
...erp5_advanced_ecommerce/Person_editPersonalInformation.py
+34
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_editPersonalInformation.xml
...rp5_advanced_ecommerce/Person_editPersonalInformation.xml
+1
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_viewAsWeb.xml
...portal_skins/erp5_advanced_ecommerce/Person_viewAsWeb.xml
+2
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_viewAsWeb/your_turnover.xml
...rp5_advanced_ecommerce/Person_viewAsWeb/your_turnover.xml
+112
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_viewAsWeb/your_vat_code.xml
...rp5_advanced_ecommerce/Person_viewAsWeb/your_vat_code.xml
+121
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_getFinalPrice.py
..._skins/erp5_advanced_ecommerce/SaleOrder_getFinalPrice.py
+4
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_getShoppingCartTotalPrice.py
...advanced_ecommerce/SaleOrder_getShoppingCartTotalPrice.py
+5
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_getTotalTax.py
...al_skins/erp5_advanced_ecommerce/SaleOrder_getTotalTax.py
+18
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_viewShoppingCartRenderer.zpt
...advanced_ecommerce/SaleOrder_viewShoppingCartRenderer.zpt
+14
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_viewShoppingCartWidgetRenderer.zpt
...ed_ecommerce/SaleOrder_viewShoppingCartWidgetRenderer.zpt
+16
-4
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_cancelShopping.py
...kins/erp5_advanced_ecommerce/WebSection_cancelShopping.py
+1
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_updateShoppingCartAccordingToUserIfNeeded.py
...e/WebSection_updateShoppingCartAccordingToUserIfNeeded.py
+5
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_updateShoppingCartAccordingToUserIfNeeded.xml
.../WebSection_updateShoppingCartAccordingToUserIfNeeded.xml
+62
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_updateShoppingCartTradeCondition.py
..._ecommerce/WebSection_updateShoppingCartTradeCondition.py
+40
-2
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_createWebSiteAccount.py
...s/erp5_advanced_ecommerce/WebSite_createWebSiteAccount.py
+13
-1
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_getOrganisationInfo.py
...ns/erp5_advanced_ecommerce/WebSite_getOrganisationInfo.py
+2
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_getOrganisationInfo.xml
...s/erp5_advanced_ecommerce/WebSite_getOrganisationInfo.xml
+70
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_viewRegistrationDialog.xml
...rp5_advanced_ecommerce/WebSite_viewRegistrationDialog.xml
+2
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_viewRegistrationDialog/your_turnover.xml
...commerce/WebSite_viewRegistrationDialog/your_turnover.xml
+97
-0
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_viewRegistrationDialog/your_vat_code.xml
...commerce/WebSite_viewRegistrationDialog/your_vat_code.xml
+106
-0
No files found.
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_editPersonalInformation.py
View file @
f5321a6d
...
...
@@ -10,14 +10,47 @@ if result_type != 'edit':
# Update data
kw
,
_
=
result
vat_code
=
kw
.
pop
(
'vat_code'
,
None
)
turnover
=
kw
.
pop
(
'turnover'
,
None
)
context
.
WebSite_executeMethodAsSuperUser
(
'edit'
,
**
kw
)
#context.edit(**kw)
result
,
result_type
=
context
.
Base_edit
(
'Person_viewAsWeb'
,
silent_mode
=
1
,
field_prefix
=
'your_'
)
if
result_type
!=
'edit'
:
return
result
# XXX add support for editable in this call
# Update data
kw
,
_
=
result
vat_code
=
kw
.
pop
(
'vat_code'
,
None
)
turnover
=
kw
.
pop
(
'turnover'
,
None
)
if
vat_code
:
subordination
=
context
.
getCareerSubordinationValue
()
if
not
subordination
:
subordination
=
context
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
context
.
edit
(
career_subordination_value
=
subordination
)
if
subordination
.
getValidationState
()
in
(
'invalidated'
,
'draft'
):
subordination
.
validate
()
subordination
.
edit
(
vat_code
=
vat_code
,
turnover
=
turnover
)
else
:
subordination
=
context
.
getCareerSubordinationValue
()
if
subordination
and
subordination
.
getValidationState
()
==
'validated'
:
subordination
.
invalidate
()
subordination
.
edit
(
vat_code
=
''
,
turnover
=
''
)
login_come_from_url
=
context
.
REQUEST
.
get
(
"field_your_login_come_from_url"
)
edit_portal_status_message
=
context
.
REQUEST
.
get
(
"field_your_edit_portal_status_message"
,
translateString
(
"Your personal informations are now updated."
))
if
login_come_from_url
is
not
None
:
from
ZTUtils
import
make_query
query
=
make_query
({
'portal_status_message'
:
edit_portal_status_message
})
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_editPersonalInformation.xml
View file @
f5321a6d
...
...
@@ -57,6 +57,7 @@
<value>
<tuple>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_viewAsWeb.xml
View file @
f5321a6d
...
...
@@ -90,6 +90,8 @@
<string>
my_first_name
</string>
<string>
my_last_name
</string>
<string>
loyalty_number
</string>
<string>
your_turnover
</string>
<string>
your_vat_code
</string>
</list>
</value>
</item>
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_viewAsWeb/your_turnover.xml
0 → 100644
View file @
f5321a6d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
default
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_turnover
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_float_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Turnover(only if you\'re an organisation)
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.WebSite_getOrganisationInfo(\'turnover\')
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Person_viewAsWeb/your_vat_code.xml
0 → 100644
View file @
f5321a6d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
default
</string>
<string>
display_width
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_vat_code
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
20
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_string_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Vat Code(only if you\\\'re an organisation)
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.WebSite_getOrganisationInfo(\'vat_code\')
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_getFinalPrice.py
View file @
f5321a6d
total_discount
=
context
.
SaleOrder_getTotalDiscount
()
total_tax
=
context
.
SaleOrder_getTotalTax
()
return
context
.
getTotalPrice
()
+
total_discount
+
total_tax
if
context
.
ERP5Site_getAuthenticatedMemberPersonValue
():
return
context
.
getTotalPrice
()
+
total_discount
+
total_tax
return
context
.
getTotalPrice
()
+
total_discount
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_getShoppingCartTotalPrice.py
View file @
f5321a6d
...
...
@@ -17,7 +17,11 @@ if sale_order is None:
if
discount
:
total
=
sale_order
.
SaleOrder_getFinalPrice
()
else
:
total
=
sale_order
.
getTotalPrice
()
+
sale_order
.
SaleOrder_getTotalTax
()
if
context
.
ERP5Site_getAuthenticatedMemberPersonValue
():
total
=
sale_order
.
getTotalPrice
()
+
context
.
SaleOrder_getTotalTax
()
else
:
total
=
sale_order
.
getTotalPrice
()
if
not
include_shipping
:
shipping_method
=
getattr
(
sale_order
,
'shipping_method'
,
None
)
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_getTotalTax.py
View file @
f5321a6d
return
round
(
sum
([
i
.
getTotalPrice
()
for
i
in
context
.
getAggregatedAmountList
(
rounding
=
True
)
ratio
=
None
ceiling
=
None
specialise_value
=
context
.
getSpecialiseValue
()
while
specialise_value
.
getPortalType
()
==
'Sale Trade Condition'
:
tml
=
specialise_value
.
contentValues
(
portal_type
=
'Trade Model Line'
)
if
tml
:
ratio
=
tml
[
0
].
getPrice
()
ceiling
=
tml
[
0
].
getProperty
(
'ceiling'
,
None
)
break
specialise_value
=
specialise_value
.
getSpecialiseValue
()
total_tax
=
round
(
sum
([
i
.
getTotalPrice
()
for
i
in
context
.
getAggregatedAmountList
(
rounding
=
True
)
if
"base_amount/trade/base/taxable/vat/vat_normal_rate"
in
i
.
getBaseApplicationList
()]),
2
)
if
ceiling
and
total_tax
>
ceiling
:
return
ceiling
return
total_tax
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_viewShoppingCartRenderer.zpt
View file @
f5321a6d
<tal:block tal:define="dummy here/WebSection_updateShoppingCartAccordingToUserIfNeeded;" />
<tal:block tal:define="shopping_cart here/SaleOrder_getShoppingCart;
web_site here/getWebSiteValue;
portal_path python:web_site.absolute_url();
current_url request/URL;
currency_code web_site/WebSite_getShoppingCartDefaultCurrencyCode;
shopping_cart_item_list shopping_cart/SaleOrder_getShoppingCartItemList;
shipping here/SaleOrder_getSelectedShippingResource;
...
...
@@ -67,7 +71,16 @@
<table cellpadding="0" cellspacing="0">
<tr>
<td><span tal:replace="python: here.Base_translateString('Tax')"/></td>
<tal:block tal:condition="python: here.ERP5Site_getAuthenticatedMemberPersonValue()">
<td> <span tal:replace="python: '%s %s' % (total_tax, currency_code)"/> </td>
</tal:block>
<tal:block tal:condition="python: not here.ERP5Site_getAuthenticatedMemberPersonValue()">
<td>
<a href="#" tal:attributes="href string:${portal_path}/login_form?came_from=${current_url}" >
<span tal:replace="python: here.Base_translateString('Tax will be displayed after login')"/>
</a>
</td>
</tal:block>
</tr>
<tr>
<td><span tal:replace="python: here.Base_translateString('Sub Total')"/></td>
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/SaleOrder_viewShoppingCartWidgetRenderer.zpt
View file @
f5321a6d
<!-- We must change the way we get the currency on sale order -->
<table>
<tal:block tal:define="dummy here/WebSection_updateShoppingCartAccordingToUserIfNeeded;" />
<tal:block tal:define="shopping_cart here/SaleOrder_getShoppingCart;
shopping_cart_item_list here/SaleOrder_getShoppingCartItemList;
web_site here/getWebSiteValue;
portal_path python:web_site.absolute_url();
current_url request/URL;
empty_cart here/SaleOrder_isShoppingCartEmpty;
discount shopping_cart/SaleOrder_getTotalDiscount;
currency web_site/WebSite_getShoppingCartDefaultCurrency;
...
...
@@ -59,14 +62,23 @@
</td></tr>
</tal:block>
<tal:block tal:condition = "python: not empty_cart
and total_tax > 0
">
<tal:block tal:condition = "python: not empty_cart">
<tr><td class="cart_middle">
<div class="cart_left">
<span tal:replace="python: here.Base_translateString('Tax')"/>
</div>
<tal:block tal:condition="python: here.ERP5Site_getAuthenticatedMemberPersonValue()">
<div class="cart_right">
<span tal:replace="total_tax"/> <span tal:replace="currency_symbol"/>
</div>
</tal:block>
<tal:block tal:condition="python: not here.ERP5Site_getAuthenticatedMemberPersonValue()">
<div class="cart_right">
<a href="#" tal:attributes="href string:${portal_path}/login_form?came_from=${current_url}" >
<span tal:replace="python: here.Base_translateString('Tax will be displayed after login')"/>
</a>
</div>
</tal:block>
</td></tr>
</tal:block>
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_cancelShopping.py
View file @
f5321a6d
...
...
@@ -16,7 +16,7 @@ sale_order = portal.portal_catalog.getResultValue(
portal_type
=
"Sale Order"
,
reference
=
shopping_cart
.
getReference
())
if
sale_order
.
getSimulationState
()
==
"draft"
:
if
sale_order
and
sale_order
.
getSimulationState
()
==
"draft"
:
# Sometimes paypal replies too fast, and order is already ordered already
# When users returns to the portal.
sale_order
.
WebSite_executeMethodAsSuperUser
(
'cancel'
,
**
{
'comment'
:
"Sale Order cancelled because: %s"
%
reason
})
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_updateShoppingCartAccordingToUserIfNeeded.py
0 → 100644
View file @
f5321a6d
if
not
context
.
ERP5Site_getAuthenticatedMemberPersonValue
():
return
shopping_cart
=
context
.
SaleOrder_getShoppingCart
()
context
.
WebSection_updateShoppingCartTradeCondition
(
shopping_cart
,
None
)
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_updateShoppingCartAccordingToUserIfNeeded.xml
0 → 100644
View file @
f5321a6d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebSection_updateShoppingCartAccordingToUserIfNeeded
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSection_updateShoppingCartTradeCondition.py
View file @
f5321a6d
...
...
@@ -17,9 +17,47 @@ if context.REQUEST.get("loyalty_reward", "") == "enable" and context.getSiteLoya
if
payment_mode
:
reference
=
'%s_%s'
%
(
reference
,
payment_mode
.
lower
())
sale_trade_condition
=
portal
.
portal_catalog
.
getResultValue
(
shopping_cart
.
edit
(
save_payment_mode
=
payment_mode
.
lower
())
elif
shopping_cart
.
getProperty
(
'save_payment_mode'
,
None
):
payment_mode
=
shopping_cart
.
getProperty
(
'save_payment_mode'
,
None
)
reference
=
'%s_%s'
%
(
reference
,
payment_mode
)
user
=
context
.
ERP5Site_getAuthenticatedMemberPersonValue
()
if
user
:
region_list
=
user
.
getDefaultAddressRegion
().
split
(
'/'
)
organisation
=
user
.
getCareerSubordinationValue
()
if
payment_mode
==
'wechat'
:
reference
=
'%s_generale'
%
reference
else
:
if
organisation
and
organisation
.
getValidationState
()
==
'validated'
:
if
region_list
[
0
]
!=
'europe'
:
reference
=
'%s_no_europe_company'
%
reference
else
:
if
region_list
[
-
1
]
==
'russian_federation'
:
reference
=
'%s_russian_federation_company'
%
reference
elif
region_list
[
-
1
]
==
'france'
:
reference
=
'%s_france_company'
%
reference
else
:
if
organisation
.
getTurnover
()
<
10000
:
reference
=
'%s_%s_company'
%
(
reference
,
region_list
[
-
1
])
else
:
reference
=
'%s_europe_company'
%
reference
else
:
if
region_list
[
0
]
!=
'europe'
:
reference
=
'%s_no_europe_individual'
%
reference
else
:
if
region_list
[
-
1
]
==
'russian_federation'
:
reference
=
'%s_russian_federation_individual'
%
reference
elif
region_list
[
-
1
]
==
'france'
:
reference
=
'%s_france_individual'
%
reference
else
:
reference
=
'%s_europe_individual'
%
reference
sale_trade_condition
=
context
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Trade Condition'
,
reference
=
'%'
+
reference
+
'%'
,
reference
=
reference
,
validation_state
=
'published'
,
limit
=
1
,
sort_on
=
((
'version'
,
'descending'
),))
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_createWebSiteAccount.py
View file @
f5321a6d
...
...
@@ -21,6 +21,9 @@ person_role = 'client'
reference
=
kw
.
pop
(
'reference'
)
password
=
kw
.
pop
(
'password'
)
kw
.
pop
(
'password_confirm'
,
None
)
vat_code
=
kw
.
pop
(
'vat_code'
,
None
)
turnover
=
kw
.
pop
(
'turnover'
,
None
)
# Check that user doesn't already exists
person_list
=
[
x
for
x
in
portal
.
acl_users
.
searchUsers
(
login
=
reference
,
exact_match
=
True
)
if
'path'
in
x
]
...
...
@@ -52,7 +55,16 @@ person.WebSite_immediateReindex()
login
.
WebSite_immediateReindex
()
person
.
WebSite_executeMethodAsSuperUser
(
'edit'
,
**
kw
)
if
vat_code
:
organisation
=
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
organisation
.
edit
(
vat_code
=
vat_code
,
turnover
=
turnover
)
organisation
.
validate
()
person
.
edit
(
career_subordination_value
=
organisation
)
is_shopping_cart
=
context
.
REQUEST
.
get
(
'is_shopping_cart'
)
if
is_shopping_cart
is
None
:
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_getOrganisationInfo.py
0 → 100644
View file @
f5321a6d
organisation
=
context
.
ERP5Site_getAuthenticatedMemberPersonValue
().
getCareerSubordinationValue
()
return
organisation
.
getProperty
(
param
,
''
)
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_getOrganisationInfo.xml
0 → 100644
View file @
f5321a6d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
param, **kw
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebSite_getOrganisationInfo
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_viewRegistrationDialog.xml
View file @
f5321a6d
...
...
@@ -68,6 +68,8 @@
<string>
your_came_from
</string>
<string>
your_is_loyalty_section
</string>
<string>
your_is_shopping_cart
</string>
<string>
your_turnover
</string>
<string>
your_vat_code
</string>
</list>
</value>
</item>
...
...
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_viewRegistrationDialog/your_turnover.xml
0 → 100644
View file @
f5321a6d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
default
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_turnover
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_float_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Turnover(only if you\'re an organisation)
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_viewRegistrationDialog/your_vat_code.xml
0 → 100644
View file @
f5321a6d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
default
</string>
<string>
display_width
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_vat_code
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
20
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_string_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Vat Code(only if you\\\'re an organisation)
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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