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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
ec1b8ba1
Commit
ec1b8ba1
authored
Sep 23, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also give higher priority to supply cells inside trade conditions during price calculation
parent
33252d75
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
4 deletions
+69
-4
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml
...ins/erp5_core/Movement_getPriceCalculationOperandDict.xml
+9
-3
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5/tests/testTradeCondition.py
product/ERP5/tests/testTradeCondition.py
+59
-0
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml
View file @
ec1b8ba1
...
...
@@ -148,10 +148,16 @@ if explanation is not None:\n
# if there are trade conditions containing supply lines related to that\n
# order/invoice, we give high priority to those supply lines\n
for trade_condition in getRelatedTradeConditionList(explanation):\n
high_priority_supply_line_list.extend(\n
list(trade_condition.contentValues(\n
for supply_line in trade_condition.contentValues(\n
portal_type=context.getPortalSupplyPathTypeList(),\n
checked_permission=\'View\')))\n
checked_permission=\'View\'):\n
supply_cell_list = supply_line.contentValues(\n
portal_type=context.getPortalSupplyPathTypeList(),\n
checked_permission=\'View\')\n
if supply_cell_list:\n
high_priority_supply_line_list.extend(list(supply_cell_list))\n
else:\n
high_priority_supply_line_list.append(supply_line)\n
\n
# XXX FIXME: Hardcoded values\n
if "Internal" in explanation_type:\n
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
ec1b8ba1
41126
\ No newline at end of file
41127
\ No newline at end of file
product/ERP5/tests/testTradeCondition.py
View file @
ec1b8ba1
...
...
@@ -55,6 +55,12 @@ class TradeConditionTestCase(ERP5TypeTestCase, SubcontentReindexingWrapper):
self
.
resource
=
self
.
portal
.
product_module
.
newContent
(
portal_type
=
'Product'
,
title
=
'Resource'
)
self
.
variated_resource
=
self
.
portal
.
product_module
.
newContent
(
portal_type
=
'Product'
,
title
=
'Variated Resource'
,
variation_base_category_list
=
[
'size'
],
variation_category_list
=
[
'size/small'
,
'size/big'
])
self
.
currency
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
'Currency'
,
title
=
'Currency'
)
...
...
@@ -302,6 +308,59 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
# using the supply line inside trade condition
self
.
assertEquals
(
2
,
line
.
getPrice
())
def
test_supply_cell_priority
(
self
):
# supply lines from related trade condition should have priority over
# supply cells from supply modules
other_supply
=
self
.
portal
.
getDefaultModule
(
self
.
supply_type
).
newContent
(
portal_type
=
self
.
supply_type
,
resource_value
=
self
.
resource
,
source_section_value
=
self
.
vendor
,
destination_section_value
=
self
.
client
)
other_supply
.
validate
()
other_supply_line
=
other_supply
.
newContent
(
portal_type
=
self
.
supply_line_type
,
resource_value
=
self
.
variated_resource
)
other_supply_line
.
setPVariationBaseCategoryList
([
'size'
])
other_supply_line
.
updateCellRange
(
base_id
=
'path'
)
self
.
tic
()
other_small_cell
=
other_supply_line
.
newCell
(
base_id
=
'path'
,
*
[
'size/small'
])
other_small_cell
.
setMappedValuePropertyList
([
'base_price'
])
other_small_cell
.
setVariationCategoryList
([
'size/small'
])
other_small_cell
.
setMembershipCriterionBaseCategoryList
([
'size'
])
other_small_cell
.
setMembershipCriterionCategoryList
([
'size/small'
])
other_small_cell
.
setBasePrice
(
1
)
supply_line
=
self
.
trade_condition
.
newContent
(
portal_type
=
self
.
supply_line_type
,
resource_value
=
self
.
variated_resource
,)
supply_line
.
setPVariationBaseCategoryList
([
'size'
])
supply_line
.
updateCellRange
(
base_id
=
'path'
)
self
.
tic
()
small_cell
=
supply_line
.
newCell
(
base_id
=
'path'
,
*
[
'size/small'
])
small_cell
.
setMappedValuePropertyList
([
'base_price'
])
small_cell
.
setVariationCategoryList
([
'size/small'
])
small_cell
.
setMembershipCriterionBaseCategoryList
([
'size'
])
small_cell
.
setMembershipCriterionCategoryList
([
'size/small'
])
small_cell
.
setBasePrice
(
2
)
self
.
order
.
setSpecialiseValue
(
self
.
trade_condition
)
self
.
order
.
setSourceSectionValue
(
self
.
vendor
)
self
.
order
.
setDestinationSectionValue
(
self
.
client
)
self
.
tic
()
line
=
self
.
order
.
newContent
(
portal_type
=
self
.
order_line_type
,
resource_value
=
self
.
variated_resource
,)
self
.
assertEquals
(
None
,
line
.
getPrice
())
line
.
setVariationBaseCategoryList
([
'size'
])
line
.
setVariationCategoryList
([
'size/small'
])
line
.
updateCellRange
(
base_id
=
'movement'
)
self
.
tic
()
cell
=
line
.
newCell
(
base_id
=
'movement'
,
*
[
'size/small'
])
cell
.
setQuantity
(
1
)
self
.
assertEquals
(
2
,
cell
.
getPrice
())
def
test_supply_line_in_invalidated_trade_condition_does_not_apply
(
self
):
# supply lines from supply modules
other_supply
=
self
.
portal
.
getDefaultModule
(
self
.
supply_type
...
...
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