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
Alexander Emmerich
erp5
Commits
38570101
Commit
38570101
authored
Nov 26, 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
0cb72f9b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
397 additions
and
0 deletions
+397
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_view.xml
...ateItem/portal_skins/erp5_pdm/InternalSupplyLine_view.xml
+1
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_view/my_product_line.xml
...kins/erp5_pdm/InternalSupplyLine_view/my_product_line.xml
+115
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_view.xml
...ateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_view.xml
+1
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_view/my_product_line.xml
...kins/erp5_pdm/PurchaseSupplyLine_view/my_product_line.xml
+115
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_view.xml
...emplateItem/portal_skins/erp5_pdm/SaleSupplyLine_view.xml
+1
-0
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_view/my_product_line.xml
...al_skins/erp5_pdm/SaleSupplyLine_view/my_product_line.xml
+115
-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/InternalSupplyLine_view.xml
View file @
38570101
...
@@ -95,6 +95,7 @@
...
@@ -95,6 +95,7 @@
<list>
<list>
<string>
my_destination_title
</string>
<string>
my_destination_title
</string>
<string>
my_resource_title
</string>
<string>
my_resource_title
</string>
<string>
my_product_line
</string>
<string>
my_priced_quantity
</string>
<string>
my_priced_quantity
</string>
<string>
my_base_unit_price
</string>
<string>
my_base_unit_price
</string>
<string>
my_quantity_unit
</string>
<string>
my_quantity_unit
</string>
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_view/my_product_line.xml
0 → 100644
View file @
38570101
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
editable
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_product_line
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_product_line
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewPDMFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
not: context/hasResource
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_view.xml
View file @
38570101
...
@@ -84,6 +84,7 @@
...
@@ -84,6 +84,7 @@
<value>
<value>
<list>
<list>
<string>
my_resource_title
</string>
<string>
my_resource_title
</string>
<string>
my_product_line
</string>
<string>
my_source_title
</string>
<string>
my_source_title
</string>
<string>
my_source_reference
</string>
<string>
my_source_reference
</string>
<string>
my_priced_quantity
</string>
<string>
my_priced_quantity
</string>
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_view/my_product_line.xml
0 → 100644
View file @
38570101
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
editable
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_product_line
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_product_line
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewPDMFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
not: context/hasResource
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_view.xml
View file @
38570101
...
@@ -95,6 +95,7 @@
...
@@ -95,6 +95,7 @@
<list>
<list>
<string>
my_destination_title
</string>
<string>
my_destination_title
</string>
<string>
my_resource_title
</string>
<string>
my_resource_title
</string>
<string>
my_product_line
</string>
<string>
my_destination_reference
</string>
<string>
my_destination_reference
</string>
<string>
my_priced_quantity
</string>
<string>
my_priced_quantity
</string>
<string>
your_quantity_unit
</string>
<string>
your_quantity_unit
</string>
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_view/my_product_line.xml
0 → 100644
View file @
38570101
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
editable
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_product_line
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_product_line
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewPDMFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
not: context/hasResource
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml
View file @
38570101
...
@@ -66,6 +66,19 @@ if context.getSource():\n
...
@@ -66,6 +66,19 @@ if context.getSource():\n
if context.getDestination():\n
if context.getDestination():\n
base_category_tuple += (\'destination\',)\n
base_category_tuple += (\'destination\',)\n
\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
#backwards compatibility\n
mapped_value_property_list = context.getMappedValuePropertyList()\n
mapped_value_property_list = context.getMappedValuePropertyList()\n
if not \'priced_quantity\' in mapped_value_property_list:\n
if not \'priced_quantity\' in mapped_value_property_list:\n
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml
View file @
38570101
...
@@ -68,6 +68,18 @@ if context.getSource():\n
...
@@ -68,6 +68,18 @@ if context.getSource():\n
if context.getDestination():\n
if context.getDestination():\n
base_category_tuple += (\'destination\',)\n
base_category_tuple += (\'destination\',)\n
\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
#backwards compatibility\n
mapped_value_property_list = context.getMappedValuePropertyList()\n
mapped_value_property_list = context.getMappedValuePropertyList()\n
if not \'priced_quantity\' in mapped_value_property_list:\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 @
38570101
...
@@ -143,6 +143,8 @@ except AttributeError:\n
...
@@ -143,6 +143,8 @@ except AttributeError:\n
# Sometime, movements doesn\'t have an explanation.\n
# Sometime, movements doesn\'t have an explanation.\n
explanation = None\n
explanation = None\n
\n
\n
specialise_set = set()\n
\n
if explanation is not None:\n
if explanation is not None:\n
explanation_type = explanation.getPortalType()\n
explanation_type = explanation.getPortalType()\n
high_priority_supply_line_list = []\n
high_priority_supply_line_list = []\n
...
@@ -157,6 +159,7 @@ if explanation is not None:\n
...
@@ -157,6 +159,7 @@ if explanation is not None:\n
high_priority_supply_line_list.extend(list(supply_cell_list))\n
high_priority_supply_line_list.extend(list(supply_cell_list))\n
else:\n
else:\n
high_priority_supply_line_list.append(supply_line)\n
high_priority_supply_line_list.append(supply_line)\n
specialise_set.add(supply_line.getParentValue().getRelativeUrl())\n
\n
\n
# XXX FIXME: Hardcoded values\n
# XXX FIXME: Hardcoded values\n
if "Internal" in explanation_type:\n
if "Internal" in explanation_type:\n
...
@@ -171,6 +174,9 @@ if explanation is not None:\n
...
@@ -171,6 +174,9 @@ if explanation is not None:\n
\n
\n
resource = context.getResourceValue()\n
resource = context.getResourceValue()\n
\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 resource is not None:\n
if isPricingOptimise():\n
if isPricingOptimise():\n
return getOptimisedPriceCalculationOperandDict(default=default, context=context, **kw)\n
return getOptimisedPriceCalculationOperandDict(default=default, context=context, **kw)\n
...
...
product/ERP5/tests/testTradeCondition.py
View file @
38570101
...
@@ -479,6 +479,24 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
...
@@ -479,6 +479,24 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
# not using the supply line inside trade condition
# not using the supply line inside trade condition
self
.
assertEqual
(
1
,
line
.
getPrice
())
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)
# TODO: move to testSupplyLine ! (which does not exist yet)
def
test_supply_line_section
(
self
):
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