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
Labels
Merge Requests
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
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
portal
=
context
.
getPortalObject
()
Base_translateString
=
portal
.
Base_translateString
delivery
=
context
if
delivery
.
getPortalType
()
in
portal
.
getPortalContainerTypeList
():
delivery
=
context
.
getExplanationValue
()
# 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
()]
line_portal_type
=
line_portal_type_list
[
0
]
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_line_id
=
"default_ssl"
use_list
=
portal
.
portal_preferences
.
getPreferredSaleUseList
()
check_stock_availability
=
True
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_line_id
=
"default_psl"
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
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_cell_portal_type
=
"Internal Supply Cell"
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
\
+
portal
.
portal_preferences
.
getPreferredSaleUseList
()
elif
line_portal_type
in
portal
.
getPortalInventoryMovementTypeList
():
section_uid
=
None
node_uid
=
None
no_inventory
=
True
use_list
=
portal
.
portal_preferences
.
getPreferredPurchaseUseList
()
\
+
portal
.
portal_preferences
.
getPreferredSaleUseList
()
...
...
@@ -52,6 +52,10 @@ else:
request
=
context
.
REQUEST
### XXX ignore owner
section_uid
=
None
total_price
=
0.0
status_message_dict
=
{}
...
...
@@ -82,10 +86,9 @@ for line in listbox:
continue
else
:
product
=
product_list
[
0
].
getObject
()
# Resource part
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
()
variation_list
=
line
[
'variation_category_list'
]
...
...
@@ -98,6 +101,7 @@ for line in listbox:
if
quantity
in
(
None
,
""
):
line
[
"quantity"
]
=
0.0
if
line
[
'price'
]
in
(
None
,
""
):
if
0
:
# XXX why not just call getPrice ?????
if
variation_list
:
# Retrieve the price from the cell
# if we have variation defined
...
...
@@ -121,9 +125,14 @@ for line in listbox:
except
KeyError
:
# No price defined
pass
else
:
# Use the price defined by the user
line
[
"total_price"
]
=
line
[
'quantity'
]
*
line
[
'price'
]
if
variation_list
:
line
[
'price'
]
=
-
1
# not implemented
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_total_price_new_%s"
%
line_id
]
=
line
[
'total_price'
]
...
...
@@ -136,17 +145,20 @@ for line in listbox:
if
variation_list
:
available_inv
=
request
.
form
[
"field_listbox_available_quantity_new_%s"
%
line_id
]
=
product
.
getAvailableInventory
(
section_uid
=
section_uid
,
node_uid
=
node_uid
,
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
,
node_uid
=
node_uid
,
variation_text
=
variation_list
)
request
.
form
[
"field_listbox_current_quantity_new_%s"
%
line_id
]
=
product
.
getCurrentInventory
(
section_uid
=
section_uid
,
node_uid
=
node_uid
,
variation_text
=
variation_list
)
else
:
available_inv
=
request
.
form
[
"field_listbox_available_quantity_new_%s"
%
line_id
]
=
product
.
getAvailableInventory
(
section_uid
=
section_uid
)
request
.
form
[
'field_listbox_inventory_new_%s'
%
line_id
]
=
product
.
get
Inventory
(
section_uid
=
section
_uid
)
request
.
form
[
"field_listbox_current_quantity_new_%s"
%
line_id
]
=
product
.
getCurrentInventory
(
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
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
,
node_uid
=
node_uid
)
# Check if quantity is available
if
check_stock_availability
and
available_inv
<
line
[
"quantity"
]:
...
...
@@ -169,10 +181,14 @@ if status_message_dict:
status_message_list
.
append
(
Base_translateString
(
message
,
mapping
=
mapping
))
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
)
return
context
.
Base_renderForm
(
request
.
form
[
'dialog_id'
],
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