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
144
Merge Requests
144
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
f8852db0
Commit
f8852db0
authored
Jul 04, 2019
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resource: update
parent
80597721
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
product/ERP5/Document/Resource.py
product/ERP5/Document/Resource.py
+2
-2
product/ERP5/Document/SupplyLine.py
product/ERP5/Document/SupplyLine.py
+15
-10
No files found.
product/ERP5/Document/Resource.py
View file @
f8852db0
...
...
@@ -712,8 +712,8 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
'non_discountable_additional_price'
:
[],
'priced_quantity'
:
None
,
'base_unit_price'
:
None
,
'slice
d_base_price_list
'
:
[],
'slice
d_quantity_range_list
'
:
[],
'slice
_base_price
'
:
[],
'slice
_quantity_range
'
:
[],
}
if
mapped_value
is
None
:
return
price_parameter_dict
...
...
product/ERP5/Document/SupplyLine.py
View file @
f8852db0
...
...
@@ -147,20 +147,26 @@ class SupplyLine(Path, Amount, XMLMatrix):
quantity_step_list
=
[
None
]
+
self
.
getQuantityStepList
()
+
[
None
]
min_quantity
=
quantity_step_list
[
index
]
max_quantity
=
quantity_step_list
[
index
+
1
]
cell
.
edit
(
sliced_quantity_range
=
(
min_quantity
,
max_quantity
))
cell
.
setSliceQuantityRange
(
(
min_quantity
,
max_quantity
))
return
cell
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'newCell'
)
def
updateCellSlice
dQuantityRange
(
self
,
base_id
):
def
updateCellSlice
ParameterList
(
self
,
base_id
):
quantity_step_list
=
[
None
]
+
self
.
getQuantityStepList
(
base_id
)
+
[
None
]
for
cell
in
self
.
getCellValueList
():
if
not
self
.
isBasePricePerSlice
():
cell
.
setSlicedQuantityRange
(
None
)
cell
.
setSliceQuantityRange
(
None
)
cell
.
setSliceBasePrice
(
None
)
else
:
try
:
index
=
quantity_step_list
.
index
(
cell
.
_range_criterion
[
'quantity'
][
0
])
except
KeyError
:
# _range_criterion is set to {} if criterion is None
index
=
0
min_quantity
=
quantity_step_list
[
index
]
max_quantity
=
quantity_step_list
[
index
+
1
]
cell
.
setSlicedQuantityRange
((
min_quantity
,
max_quantity
))
cell
.
setSliceQuantityRange
((
min_quantity
,
max_quantity
))
cell
.
setSliceBasePrice
(
cell
.
getBasePrice
())
############################################################
# Quantity predicate API
...
...
@@ -172,7 +178,7 @@ class SupplyLine(Path, Amount, XMLMatrix):
Return predicate id related to a price parameter.
"""
predicate_id_start_with
=
"quantity_range_"
if
price_parameter
not
in
(
"base_price"
,
"slice
d
_base_price"
):
if
price_parameter
not
in
(
"base_price"
,
"slice_base_price"
):
predicate_id_start_with
=
"%s_%s"
%
\
(
price_parameter
,
predicate_id_start_with
)
# XXX Hardcoded portal type name
...
...
@@ -202,7 +208,7 @@ class SupplyLine(Path, Amount, XMLMatrix):
"""
# We need to keep compatibility with generated accessor
price_parameter
=
kw
.
get
(
'price_parameter'
,
"base_price"
)
if
price_parameter
in
(
"base_price"
,
"slice
d
_base_price"
):
if
price_parameter
in
(
"base_price"
,
"slice_base_price"
):
method_name
=
"_baseGetQuantityStepList"
else
:
method_name
=
'get%sList'
%
\
...
...
@@ -227,7 +233,7 @@ class SupplyLine(Path, Amount, XMLMatrix):
# With this script, we can change the title of the predicate
script
=
getattr
(
self
,
'SupplyLine_getTitle'
,
None
)
predicate_id_start_with
=
"quantity_range"
if
price_parameter
not
in
(
"base_price"
,
"slice
d
_base_price"
):
if
price_parameter
not
in
(
"base_price"
,
"slice_base_price"
):
predicate_id_start_with
=
"%s_%s"
%
\
(
price_parameter
,
predicate_id_start_with
)
for
i
in
range
(
0
,
len
(
quantity_step_list
)
-
1
):
...
...
@@ -236,12 +242,11 @@ class SupplyLine(Path, Amount, XMLMatrix):
# XXX Hardcoded portal type name
p
=
self
.
newContent
(
id
=
'%s_%s'
%
(
predicate_id_start_with
,
str
(
i
)),
portal_type
=
'Predicate'
,
int_index
=
i
+
1
)
self
.
log
(
'Nicolas, creating predicate %s'
%
p
.
getId
())
p
.
setCriterionPropertyList
((
'quantity'
,
))
p
.
setCriterion
(
'quantity'
,
min
=
min_quantity
,
max
=
(
None
if
price_parameter
==
'slice
d
_base_price'
else
max_quantity
)
max
=
(
None
if
price_parameter
==
'slice_base_price'
else
max_quantity
)
)
if
script
is
not
None
:
title
=
script
(
min
=
min_quantity
,
max
=
max_quantity
)
...
...
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