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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Noah Brackenbury
erp5
Commits
0ad99c2d
Commit
0ad99c2d
authored
Nov 30, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdm/trade: make price from trade conditions only apply if the trade condition is used in this order
parent
bd1f1e04
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
0 deletions
+49
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml
...lateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml
+13
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml
...lateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml
+12
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml
...ins/erp5_core/Movement_getPriceCalculationOperandDict.xml
+6
-0
product/ERP5/tests/testTradeCondition.py
product/ERP5/tests/testTradeCondition.py
+18
-0
No files found.
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml
View file @
0ad99c2d
...
...
@@ -66,6 +66,19 @@ if context.getSource():\n
if context.getDestination():\n
base_category_tuple += (\'destination\',)\n
\n
if context.getParentValue().getParentValue().getPortalType() in (\n
## XXX There is no portal type group for trade conditions.\n
\'Sale Trade Condition\',\n
\'Purchase Trade Condition\',\n
\'Internal Trade Condition\'):\n
# Supply Lines from trade conditions are set as specialise to this trade condition,\n
# so that we can apply a predicate on movements later. Supply Lines from trade condition\n
# only apply on movements using these trade conditions.\n
category_list = context.getCategoryList() + [\'specialise/%s\' % context.getParentValue().getParentValue().getRelativeUrl()]\n
context = context.asContext(categories=category_list)\n
base_category_tuple += (\'specialise\', )\n
\n
\n
#backwards compatibility\n
mapped_value_property_list = context.getMappedValuePropertyList()\n
if not \'priced_quantity\' in mapped_value_property_list:\n
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml
View file @
0ad99c2d
...
...
@@ -68,6 +68,18 @@ if context.getSource():\n
if context.getDestination():\n
base_category_tuple += (\'destination\',)\n
\n
if context.getParentValue().getPortalType() in (\n
## XXX There is no portal type group for trade conditions.\n
\'Sale Trade Condition\',\n
\'Purchase Trade Condition\',\n
\'Internal Trade Condition\'):\n
# Supply Lines from trade conditions are set as specialise to this trade condition,\n
# so that we can apply a predicate on movements later. Supply Lines from trade condition\n
# only apply on movements using these trade conditions.\n
category_list = context.getCategoryList() + [\'specialise/%s\' % context.getParentValue().getRelativeUrl()]\n
context = context.asContext(categories=category_list)\n
base_category_tuple += (\'specialise\', )\n
\n
#backwards compatibility\n
mapped_value_property_list = context.getMappedValuePropertyList()\n
if not \'priced_quantity\' in mapped_value_property_list:\n
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml
View file @
0ad99c2d
...
...
@@ -143,6 +143,8 @@ except AttributeError:\n
# Sometime, movements doesn\'t have an explanation.\n
explanation = None\n
\n
specialise_set = set()\n
\n
if explanation is not None:\n
explanation_type = explanation.getPortalType()\n
high_priority_supply_line_list = []\n
...
...
@@ -157,6 +159,7 @@ if explanation is not None:\n
high_priority_supply_line_list.extend(list(supply_cell_list))\n
else:\n
high_priority_supply_line_list.append(supply_line)\n
specialise_set.add(supply_line.getParentValue().getRelativeUrl())\n
\n
# XXX FIXME: Hardcoded values\n
if "Internal" in explanation_type:\n
...
...
@@ -171,6 +174,9 @@ if explanation is not None:\n
\n
resource = context.getResourceValue()\n
\n
if specialise_set:\n
kw[\'categories\'] = kw.get(\'categories\', []) + [\'specialise/%s\' % x for x in specialise_set]\n
\n
if resource is not None:\n
if isPricingOptimise():\n
return getOptimisedPriceCalculationOperandDict(default=default, context=context, **kw)\n
...
...
product/ERP5/tests/testTradeCondition.py
View file @
0ad99c2d
...
...
@@ -479,6 +479,24 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
# not using the supply line inside trade condition
self
.
assertEqual
(
1
,
line
.
getPrice
())
def
test_supply_line_in_other_trade_condition_does_not_apply
(
self
):
"""Supply lines from trade condition not related to an order does not apply.
"""
supply_line
=
self
.
trade_condition
.
newContent
(
portal_type
=
self
.
supply_line_type
,
resource_value
=
self
.
resource
,
base_price
=
2
)
self
.
assertEqual
(
None
,
self
.
order
.
getSpecialiseValue
())
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
.
resource
,
quantity
=
1
)
# not using the supply line inside trade condition
self
.
assertEqual
(
None
,
line
.
getPrice
())
# TODO: move to testSupplyLine ! (which does not exist yet)
def
test_supply_line_section
(
self
):
...
...
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