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
Nikola Balog
erp5
Commits
66e4d101
Commit
66e4d101
authored
Jun 24, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: display price according to sale trade condition
parent
cc87198d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
40 deletions
+56
-40
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_updateFastInputLineList.py
...rtal_skins/erp5_trade/Delivery_updateFastInputLineList.py
+56
-40
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_updateFastInputLineList.py
View file @
66e4d101
...
@@ -14,34 +14,34 @@ check_stock_availability = False
...
@@ -14,34 +14,34 @@ check_stock_availability = False
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
Base_translateString
=
portal
.
Base_translateString
Base_translateString
=
portal
.
Base_translateString
delivery
=
context
if
delivery
.
getPortalType
()
in
portal
.
getPortalContainerTypeList
():
delivery
=
context
.
getExplanationValue
()
# Retrieve lines portal type
# Retrieve lines portal type
line_portal_type_list
=
[
x
for
x
in
delivery
.
getTypeInfo
().
getTypeAllowedContentTypeList
()
\
line_portal_type_list
=
[
x
for
x
in
context
.
getTypeInfo
().
getTypeAllowedContentTypeList
()
\
if
x
in
portal
.
getPortalMovementTypeList
()]
if
x
in
portal
.
getPortalMovementTypeList
()]
line_portal_type
=
line_portal_type_list
[
0
]
line_portal_type
=
line_portal_type_list
[
0
]
if
line_portal_type
in
portal
.
getPortalSaleTypeList
():
if
line_portal_type
in
portal
.
getPortalSaleTypeList
():
section_uid
=
delivery
.
getSourceSectionUid
()
section_uid
=
context
.
getSourceSectionUid
()
node_uid
=
context
.
getSourceUid
()
supply_cell_portal_type
=
"Sale Supply Cell"
supply_cell_portal_type
=
"Sale Supply Cell"
supply_line_id
=
"default_ssl"
supply_line_id
=
"default_ssl"
use_list
=
portal
.
portal_preferences
.
getPreferredSaleUseList
()
use_list
=
portal
.
portal_preferences
.
getPreferredSaleUseList
()
check_stock_availability
=
True
check_stock_availability
=
True
elif
line_portal_type
in
portal
.
getPortalPurchaseTypeList
():
elif
line_portal_type
in
portal
.
getPortalPurchaseTypeList
():
section_uid
=
delivery
.
getDestinationSectionUid
()
section_uid
=
context
.
getDestinationSectionUid
()
node_uid
=
context
.
getDestinationUid
()
supply_cell_portal_type
=
"Purchase Supply Cell"
supply_cell_portal_type
=
"Purchase Supply Cell"
supply_line_id
=
"default_psl"
supply_line_id
=
"default_psl"
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
elif
line_portal_type
in
portal
.
getPortalInternalTypeList
():
elif
line_portal_type
in
portal
.
getPortalInternalTypeList
():
section_uid
=
None
section_uid
=
None
# XXX ralf hack, we don't care about stock by ownership
node_uid
=
context
.
getSourceUid
()
supply_line_id
=
"default_isl"
supply_line_id
=
"default_isl"
supply_cell_portal_type
=
"Internal Supply Cell"
supply_cell_portal_type
=
"Internal Supply Cell"
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
\
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
\
+
portal
.
portal_preferences
.
getPreferredSaleUseList
()
+
portal
.
portal_preferences
.
getPreferredSaleUseList
()
elif
line_portal_type
in
portal
.
getPortalInventoryMovementTypeList
():
elif
line_portal_type
in
portal
.
getPortalInventoryMovementTypeList
():
section_uid
=
None
section_uid
=
None
node_uid
=
None
no_inventory
=
True
no_inventory
=
True
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
\
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
\
+
portal
.
portal_preferences
.
getPreferredSaleUseList
()
+
portal
.
portal_preferences
.
getPreferredSaleUseList
()
...
@@ -52,6 +52,10 @@ else:
...
@@ -52,6 +52,10 @@ else:
request
=
context
.
REQUEST
request
=
context
.
REQUEST
### XXX ignore owner
section_uid
=
None
total_price
=
0.0
total_price
=
0.0
status_message_dict
=
{}
status_message_dict
=
{}
...
@@ -82,10 +86,9 @@ for line in listbox:
...
@@ -82,10 +86,9 @@ for line in listbox:
continue
continue
else
:
else
:
product
=
product_list
[
0
].
getObject
()
product
=
product_list
[
0
].
getObject
()
# Resource part
# Resource part
line
[
"resource_relative_url"
]
=
product
.
getRelativeUrl
()
#cell.getResource()
line
[
"resource_relative_url"
]
=
product
.
getRelativeUrl
()
#cell.getResource()
request
.
form
[
"field_listbox_resource_relative_url_new_%s"
%
line_id
]
=
product
.
getRelativeUrl
(
)
request
.
set
(
"field_listbox_resource_relative_url_new_%s"
%
line_id
,
product
.
getRelativeUrl
()
)
request
.
form
[
"field_listbox_quantity_unit_new_%s"
%
line_id
]
=
product
.
getQuantityUnit
()
request
.
form
[
"field_listbox_quantity_unit_new_%s"
%
line_id
]
=
product
.
getQuantityUnit
()
variation_list
=
line
[
'variation_category_list'
]
variation_list
=
line
[
'variation_category_list'
]
...
@@ -98,6 +101,7 @@ for line in listbox:
...
@@ -98,6 +101,7 @@ for line in listbox:
if
quantity
in
(
None
,
""
):
if
quantity
in
(
None
,
""
):
line
[
"quantity"
]
=
0.0
line
[
"quantity"
]
=
0.0
if
line
[
'price'
]
in
(
None
,
""
):
if
line
[
'price'
]
in
(
None
,
""
):
if
0
:
# XXX why not just call getPrice ?????
if
variation_list
:
if
variation_list
:
# Retrieve the price from the cell
# Retrieve the price from the cell
# if we have variation defined
# if we have variation defined
...
@@ -121,9 +125,14 @@ for line in listbox:
...
@@ -121,9 +125,14 @@ for line in listbox:
except
KeyError
:
except
KeyError
:
# No price defined
# No price defined
pass
pass
else
:
if
variation_list
:
# Use the price defined by the user
line
[
'price'
]
=
-
1
# not implemented
line
[
"total_price"
]
=
line
[
'quantity'
]
*
line
[
'price'
]
line
[
'price'
]
=
context
.
newContent
(
temp_object
=
True
,
portal_type
=
line_portal_type
,
resource_value
=
product
,
quantity
=
line
[
'quantity'
]).
getPrice
()
line
[
"total_price"
]
=
line
[
'quantity'
]
*
(
line
[
'price'
]
or
0
)
request
.
form
[
"field_listbox_price_new_%s"
%
line_id
]
=
line
[
'price'
]
request
.
form
[
"field_listbox_price_new_%s"
%
line_id
]
=
line
[
'price'
]
request
.
form
[
"field_listbox_total_price_new_%s"
%
line_id
]
=
line
[
'total_price'
]
request
.
form
[
"field_listbox_total_price_new_%s"
%
line_id
]
=
line
[
'total_price'
]
...
@@ -136,17 +145,20 @@ for line in listbox:
...
@@ -136,17 +145,20 @@ for line in listbox:
if
variation_list
:
if
variation_list
:
available_inv
=
request
.
form
[
"field_listbox_available_quantity_new_%s"
%
line_id
]
=
product
.
getAvailableInventory
(
available_inv
=
request
.
form
[
"field_listbox_available_quantity_new_%s"
%
line_id
]
=
product
.
getAvailableInventory
(
section_uid
=
section_uid
,
section_uid
=
section_uid
,
node_uid
=
node_uid
,
variation_text
=
variation_list
)
variation_text
=
variation_list
)
request
.
form
[
'field_listbox_inventory_new_%s'
%
line_id
]
=
product
.
getInventory
(
request
.
form
[
'field_listbox_inventory_new_%s'
%
line_id
]
=
product
.
get
Future
Inventory
(
section_uid
=
section_uid
,
section_uid
=
section_uid
,
node_uid
=
node_uid
,
variation_text
=
variation_list
)
variation_text
=
variation_list
)
request
.
form
[
"field_listbox_current_quantity_new_%s"
%
line_id
]
=
product
.
getCurrentInventory
(
request
.
form
[
"field_listbox_current_quantity_new_%s"
%
line_id
]
=
product
.
getCurrentInventory
(
section_uid
=
section_uid
,
section_uid
=
section_uid
,
node_uid
=
node_uid
,
variation_text
=
variation_list
)
variation_text
=
variation_list
)
else
:
else
:
available_inv
=
request
.
form
[
"field_listbox_available_quantity_new_%s"
%
line_id
]
=
product
.
getAvailableInventory
(
section_uid
=
section_uid
)
available_inv
=
request
.
form
[
"field_listbox_available_quantity_new_%s"
%
line_id
]
=
product
.
getAvailableInventory
(
section_uid
=
section_uid
,
node_uid
=
node_uid
)
request
.
form
[
'field_listbox_inventory_new_%s'
%
line_id
]
=
product
.
get
Inventory
(
section_uid
=
section
_uid
)
request
.
form
[
'field_listbox_inventory_new_%s'
%
line_id
]
=
product
.
get
FutureInventory
(
section_uid
=
section_uid
,
node_uid
=
node
_uid
)
request
.
form
[
"field_listbox_current_quantity_new_%s"
%
line_id
]
=
product
.
getCurrentInventory
(
section_uid
=
section_uid
)
request
.
form
[
"field_listbox_current_quantity_new_%s"
%
line_id
]
=
product
.
getCurrentInventory
(
section_uid
=
section_uid
,
node_uid
=
node_uid
)
# Check if quantity is available
# Check if quantity is available
if
check_stock_availability
and
available_inv
<
line
[
"quantity"
]:
if
check_stock_availability
and
available_inv
<
line
[
"quantity"
]:
...
@@ -169,10 +181,14 @@ if status_message_dict:
...
@@ -169,10 +181,14 @@ if status_message_dict:
status_message_list
.
append
(
Base_translateString
(
message
,
mapping
=
mapping
))
status_message_list
.
append
(
Base_translateString
(
message
,
mapping
=
mapping
))
portal_status_message
=
' -- '
.
join
(
status_message_list
)
portal_status_message
=
' -- '
.
join
(
status_message_list
)
request
.
form
[
"field_my_total_price"
]
=
total_price
#request.set('portal_status_message', ' -- '.join(status_message_list))
request
.
form
[
"field_my_total_price"
]
=
total_price
context
.
Base_updateDialogForm
(
listbox
=
listbox
,
update
=
1
,
kw
=
kw
)
context
.
Base_updateDialogForm
(
listbox
=
listbox
,
update
=
1
,
kw
=
kw
)
return
context
.
Base_renderForm
(
return
context
.
Base_renderForm
(
request
.
form
[
'dialog_id'
],
request
.
form
[
'dialog_id'
],
message
=
portal_status_message
message
=
portal_status_message
)
)
"""
return getattr(context, request.form['dialog_id'])(listbox=listbox, kw=kw)
"""
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