diff --git a/bt5/erp5_pdm/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/bt5/erp5_pdm/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml index 5043fcc3224de2e3f00780e59d78c36bb3460110..16c8603c095c6304f58fccb5a29e2a8479b8a5a5 100644 --- a/bt5/erp5_pdm/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml +++ b/bt5/erp5_pdm/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml @@ -7,6 +7,10 @@ Internal Supply edit_workflow, validation_workflow + + Internal Supply Cell + supply_cell_interaction_workflow + Internal Supply Line edit_workflow, reindex_object_interaction_workflow, supply_line_interaction_workflow @@ -23,6 +27,10 @@ Purchase Supply edit_workflow, validation_workflow + + Purchase Supply Cell + supply_cell_interaction_workflow + Purchase Supply Line edit_workflow, reindex_object_interaction_workflow, supply_line_interaction_workflow @@ -43,6 +51,10 @@ Sale Supply edit_workflow, validation_workflow + + Sale Supply Cell + supply_cell_interaction_workflow + Sale Supply Line edit_workflow, reindex_object_interaction_workflow, supply_line_interaction_workflow @@ -51,6 +63,10 @@ Service edit_workflow, validation_workflow + + Supply Cell + supply_cell_interaction_workflow + Supply Line edit_workflow, reindex_object_interaction_workflow, supply_line_interaction_workflow diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary.xml index 1ac8f806f77a7c157febffa4ac25f2ae4087be44..9acc6960208c6f04315b929f11e66305037b55f0 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary.xml @@ -226,6 +226,7 @@ my_max_order_quantity_variation_base_category_list matrixbox_for_max_order_quantity my_view_mode_target_delivery + my_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary/my_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary/my_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..8edae66b7a1850f5f5abc5a5c02bf795dc588f32 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary/my_base_price_per_slice.xml @@ -0,0 +1,84 @@ + + + + + + + + + + delegated_list + + + title + + + + + id + my_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_checkbox + + + form_id + Base_viewFieldLibrary + + + title + Base Price Applies to Items in Slice + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary/my_quantity_step_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary/my_quantity_step_list.xml index 210da471d60841414979d5eae8e7500ad7ae62d6..8a0e3a172e70ca5b99523879e695ea656c05aeee 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary/my_quantity_step_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Base_viewPDMFieldLibrary/my_quantity_step_list.xml @@ -11,7 +11,6 @@ css_class - default external_validator title width @@ -57,10 +56,12 @@ - default - - AAAAAAAAAAI= - + css_class + + + + external_validator + field_id @@ -74,6 +75,14 @@ target + + title + + + + width + + @@ -85,16 +94,10 @@ css_class figure - - default - - - - external_validator - AAAAAAAAAAM= + AAAAAAAAAAI= @@ -124,19 +127,6 @@ - - - - - - - _text - python:[str(x) for x in here.getQuantityStepList()] - - - - - diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice.xml index efc003b6eefec1a0f2f12c04b807139c1fc66466..f4affb76983c24fb272f3850ab79ab81cbabb10d 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice.xml @@ -106,6 +106,7 @@ my_price_currency my_start_date_range_min my_start_date_range_max + my_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice/mapped_value_property_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice/mapped_value_property_list.xml index 4ea8b3a219066b5a4f1ddb7e00b7caf909e17ef9..66be29faa35df1a4816039a1f681a0a7e5321cb8 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice/mapped_value_property_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice/mapped_value_property_list.xml @@ -9,7 +9,9 @@ delegated_list - + + default + @@ -50,6 +52,12 @@ tales + + default + + AAAAAAAAAAI= + + field_id @@ -69,6 +77,14 @@ values + + default + + + base_price + + + field_id my_mapped_value_property_list @@ -87,4 +103,17 @@ + + + + + + + + _text + python: [\'base_price\', \'base_unit_price\', \'slice_base_price\', \'slice_quantity_range\'] + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice/my_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice/my_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..570d9bd0ed8a00f0ced261f2061af9d0f38ce191 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/InternalSupplyLine_viewBasePrice/my_base_price_per_slice.xml @@ -0,0 +1,78 @@ + + + + + + + + + + delegated_list + + + + + + id + my_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_base_price_per_slice + + + form_id + Base_viewPDMFieldLibrary + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice.xml index be2dd55257d9ddadd171d4ac850496f4bca2c76b..8746793d5c92cd58ab3f308bfba9dcee2912cd62 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice.xml @@ -106,6 +106,7 @@ my_price_currency my_start_date_range_min my_start_date_range_max + my_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice/mapped_value_property_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice/mapped_value_property_list.xml index 36ef4d3a63dc114d81311e2943402c7057d1a65e..3681d95aeea6d8c363372011e097a1e5eb61436a 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice/mapped_value_property_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice/mapped_value_property_list.xml @@ -2,10 +2,18 @@ - + + + delegated_list + + + default + + + id mapped_value_property_list @@ -18,22 +26,6 @@ external_validator_failed The input failed the external validator. - - line_too_long - A line was too long. - - - required_not_found - Input is required but no input given. - - - too_long - You entered too many characters. - - - too_many_lines - You entered too many lines. - @@ -42,79 +34,11 @@ - alternate_name - - - - css_class - - - - default - - - - description - - - - editable + field_id - enabled - - - - external_validator - - - - extra - - - - height - - - - hidden - - - - max_length - - - - max_linelength - - - - max_lines - - - - required - - - - title - - - - unicode - - - - view_separator - - - - whitespace_preserve - - - - width + form_id @@ -124,80 +48,18 @@ tales - - alternate_name - - - - css_class - - default - - - - description - - - - editable - - - - enabled - - - - external_validator - - - - extra - - - - height - - - - hidden - - - - max_length - - - - max_linelength - - - - max_lines - - - - required - - - - title - - - - unicode - - - - view_separator - + + AAAAAAAAAAI= + - whitespace_preserve + field_id - width + form_id @@ -207,14 +69,6 @@ values - - alternate_name - - - - css_class - - default @@ -224,68 +78,12 @@ - description - - - - editable - 1 + field_id + my_mapped_value_property_list - enabled - 1 - - - external_validator - - - - extra - - - - height - 5 - - - hidden - 1 - - - max_length - - - - max_linelength - - - - max_lines - - - - required - 0 - - - title - Modified categories - - - unicode - 0 - - - view_separator - - - - whitespace_preserve - 0 - - - width - 40 + form_id + Base_viewPDMFieldLibrary @@ -293,4 +91,17 @@ + + + + + + + + _text + python: [\'base_price\', \'base_unit_price\', \'slice_base_price\', \'slice_quantity_range\'] + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice/my_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice/my_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..570d9bd0ed8a00f0ced261f2061af9d0f38ce191 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/PurchaseSupplyLine_viewBasePrice/my_base_price_per_slice.xml @@ -0,0 +1,78 @@ + + + + + + + + + + delegated_list + + + + + + id + my_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_base_price_per_slice + + + form_id + Base_viewPDMFieldLibrary + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py index 3acae67812f4e7bacca9f572de83260348db7363..81d7adc144123ac2eaf0d6a011eef2d8a03f5eea 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py @@ -1,6 +1,11 @@ +from math import log + result = context.getPriceParameterDict(context=movement, **kw) # Calculate +# If slice_base_price: +# base_price = SUM(number_of_items_in_slice * slice_base_price) for each slice +# Then # ((base_price + SUM(additional_price) + # variable_value * SUM(variable_additional_price)) * # (1 - MIN(1, MAX(SUM(discount_ratio) , exclusive_discount_ratio ))) + @@ -17,6 +22,23 @@ result = context.getPriceParameterDict(context=movement, **kw) # depends on discrete variations, but also on a continuous property # of the object +if result["slice_base_price"]: + total_price = 0. + quantity = movement.getQuantity() + sliced_base_price_list = zip(result["slice_base_price"], result["slice_quantity_range"]) + for slice_price, slice_range in sliced_base_price_list: + slice_min, slice_max = slice_range + if slice_max is None: + slice_max = quantity + 1 + if slice_min is None: + slice_min = 1 + priced_quantity = min(slice_max - 1, quantity) - (slice_min - 1) + total_price += priced_quantity * slice_price + if result.get('base_unit_price', None) is None: + result["base_price"] = total_price / quantity + else: + result["base_price"] = round(total_price / quantity, int(round(- log(result['base_unit_price'], 10),0))) + base_price = result["base_price"] if base_price in (None, ""): # XXX Compatibility diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine.xml index d77c92c0aa72aa4338e15aab44599f3e691ed7d0..fddd16d97f9a481e5ed7b3afa033a02cd30ee440 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine.xml @@ -116,6 +116,7 @@ my_internal_supply_line_max_flow my_internal_supply_line_min_stock my_internal_supply_line_max_stock + my_internal_supply_line_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine/mapped_value_property_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine/mapped_value_property_list.xml index 4ea8b3a219066b5a4f1ddb7e00b7caf909e17ef9..d1ff36fc9d44ccef3e37edac644b871dd898b3b0 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine/mapped_value_property_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine/mapped_value_property_list.xml @@ -9,7 +9,9 @@ delegated_list - + + default + @@ -69,6 +71,17 @@ values + + default + + + base_price + base_unit_price + slice_base_price + slice_quantity_range + + + field_id my_mapped_value_property_list diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine/my_internal_supply_line_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine/my_internal_supply_line_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..194bb32d02c7fa9cbb349a86a16fdf34216570b0 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultInternalSupplyLine/my_internal_supply_line_base_price_per_slice.xml @@ -0,0 +1,78 @@ + + + + + + + + + + delegated_list + + + + + + id + my_internal_supply_line_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_base_price_per_slice + + + form_id + Base_viewPDMFieldLibrary + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine.xml index 3d8b18ca1337b37186a94c30f45c7dbadce20d93..d76aa9d12fedf58948faa0528a1ed45cce37a61f 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine.xml @@ -116,6 +116,7 @@ my_purchase_supply_line_max_flow my_purchase_supply_line_min_stock my_purchase_supply_line_max_stock + my_purchase_supply_line_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine/mapped_value_property_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine/mapped_value_property_list.xml index 4ea8b3a219066b5a4f1ddb7e00b7caf909e17ef9..d1ff36fc9d44ccef3e37edac644b871dd898b3b0 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine/mapped_value_property_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine/mapped_value_property_list.xml @@ -9,7 +9,9 @@ delegated_list - + + default + @@ -69,6 +71,17 @@ values + + default + + + base_price + base_unit_price + slice_base_price + slice_quantity_range + + + field_id my_mapped_value_property_list diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine/my_purchase_supply_line_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine/my_purchase_supply_line_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..87dac4dd2e0aa5a5c6aeb821bd061bfc615a0c46 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultPurchaseSupplyLine/my_purchase_supply_line_base_price_per_slice.xml @@ -0,0 +1,78 @@ + + + + + + + + + + delegated_list + + + + + + id + my_purchase_supply_line_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_base_price_per_slice + + + form_id + Base_viewPDMFieldLibrary + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine.xml index 717de0ebb2a6b06e2facd48ed48193b046944371..a78137261f04b23232e849cf2745527cd8a2c9c4 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine.xml @@ -116,6 +116,7 @@ my_sale_supply_line_max_flow my_sale_supply_line_min_stock my_sale_supply_line_max_stock + my_sale_supply_line_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine/mapped_value_property_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine/mapped_value_property_list.xml index 4ea8b3a219066b5a4f1ddb7e00b7caf909e17ef9..d1ff36fc9d44ccef3e37edac644b871dd898b3b0 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine/mapped_value_property_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine/mapped_value_property_list.xml @@ -9,7 +9,9 @@ delegated_list - + + default + @@ -69,6 +71,17 @@ values + + default + + + base_price + base_unit_price + slice_base_price + slice_quantity_range + + + field_id my_mapped_value_property_list diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine/my_sale_supply_line_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine/my_sale_supply_line_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..18adfd0fb79aea2ba0bf70ea8d2709d54edde279 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_viewDefaultSaleSupplyLine/my_sale_supply_line_base_price_per_slice.xml @@ -0,0 +1,78 @@ + + + + + + + + + + delegated_list + + + + + + id + my_sale_supply_line_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_base_price_per_slice + + + form_id + Base_viewPDMFieldLibrary + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice.xml index be0a408d20fd9941e70db0b40d895cb0851b30c3..2b7b28aa93ba6279a427f4daf1007d03167f6c04 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice.xml @@ -106,6 +106,7 @@ my_price_currency my_start_date_range_min my_start_date_range_max + my_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/mapped_value_property_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/mapped_value_property_list.xml index 36ef4d3a63dc114d81311e2943402c7057d1a65e..3681d95aeea6d8c363372011e097a1e5eb61436a 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/mapped_value_property_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/mapped_value_property_list.xml @@ -2,10 +2,18 @@ - + + + delegated_list + + + default + + + id mapped_value_property_list @@ -18,22 +26,6 @@ external_validator_failed The input failed the external validator. - - line_too_long - A line was too long. - - - required_not_found - Input is required but no input given. - - - too_long - You entered too many characters. - - - too_many_lines - You entered too many lines. - @@ -42,79 +34,11 @@ - alternate_name - - - - css_class - - - - default - - - - description - - - - editable + field_id - enabled - - - - external_validator - - - - extra - - - - height - - - - hidden - - - - max_length - - - - max_linelength - - - - max_lines - - - - required - - - - title - - - - unicode - - - - view_separator - - - - whitespace_preserve - - - - width + form_id @@ -124,80 +48,18 @@ tales - - alternate_name - - - - css_class - - default - - - - description - - - - editable - - - - enabled - - - - external_validator - - - - extra - - - - height - - - - hidden - - - - max_length - - - - max_linelength - - - - max_lines - - - - required - - - - title - - - - unicode - - - - view_separator - + + AAAAAAAAAAI= + - whitespace_preserve + field_id - width + form_id @@ -207,14 +69,6 @@ values - - alternate_name - - - - css_class - - default @@ -224,68 +78,12 @@ - description - - - - editable - 1 + field_id + my_mapped_value_property_list - enabled - 1 - - - external_validator - - - - extra - - - - height - 5 - - - hidden - 1 - - - max_length - - - - max_linelength - - - - max_lines - - - - required - 0 - - - title - Modified categories - - - unicode - 0 - - - view_separator - - - - whitespace_preserve - 0 - - - width - 40 + form_id + Base_viewPDMFieldLibrary @@ -293,4 +91,17 @@ + + + + + + + + _text + python: [\'base_price\', \'base_unit_price\', \'slice_base_price\', \'slice_quantity_range\'] + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/my_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/my_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..570d9bd0ed8a00f0ced261f2061af9d0f38ce191 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/my_base_price_per_slice.xml @@ -0,0 +1,78 @@ + + + + + + + + + + delegated_list + + + + + + id + my_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_base_price_per_slice + + + form_id + Base_viewPDMFieldLibrary + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/my_quantity_step_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/my_quantity_step_list.xml index 66830bcdb83794d2d9c2eafbd332d4fcd5979a67..e5bc1d0f57c06066b257a478dabcdf53b51b6050 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/my_quantity_step_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SaleSupplyLine_viewBasePrice/my_quantity_step_list.xml @@ -307,7 +307,7 @@ _text - python:[str(x) for x in here.getQuantityStepList()] + python:[str(x) for x in context.getQuantityStepList([])] diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice.xml index 66d9f62568a95df61e1fb6c051c9ed3f89b0d5ce..26625efe9281d847bb21a944948ad595bafc717d 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice.xml @@ -95,6 +95,7 @@ my_quantity_unit my_price_currency my_start_date_range_max + my_base_price_per_slice diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/mapped_value_property_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/mapped_value_property_list.xml index 36ef4d3a63dc114d81311e2943402c7057d1a65e..3681d95aeea6d8c363372011e097a1e5eb61436a 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/mapped_value_property_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/mapped_value_property_list.xml @@ -2,10 +2,18 @@ - + + + delegated_list + + + default + + + id mapped_value_property_list @@ -18,22 +26,6 @@ external_validator_failed The input failed the external validator. - - line_too_long - A line was too long. - - - required_not_found - Input is required but no input given. - - - too_long - You entered too many characters. - - - too_many_lines - You entered too many lines. - @@ -42,79 +34,11 @@ - alternate_name - - - - css_class - - - - default - - - - description - - - - editable + field_id - enabled - - - - external_validator - - - - extra - - - - height - - - - hidden - - - - max_length - - - - max_linelength - - - - max_lines - - - - required - - - - title - - - - unicode - - - - view_separator - - - - whitespace_preserve - - - - width + form_id @@ -124,80 +48,18 @@ tales - - alternate_name - - - - css_class - - default - - - - description - - - - editable - - - - enabled - - - - external_validator - - - - extra - - - - height - - - - hidden - - - - max_length - - - - max_linelength - - - - max_lines - - - - required - - - - title - - - - unicode - - - - view_separator - + + AAAAAAAAAAI= + - whitespace_preserve + field_id - width + form_id @@ -207,14 +69,6 @@ values - - alternate_name - - - - css_class - - default @@ -224,68 +78,12 @@ - description - - - - editable - 1 + field_id + my_mapped_value_property_list - enabled - 1 - - - external_validator - - - - extra - - - - height - 5 - - - hidden - 1 - - - max_length - - - - max_linelength - - - - max_lines - - - - required - 0 - - - title - Modified categories - - - unicode - 0 - - - view_separator - - - - whitespace_preserve - 0 - - - width - 40 + form_id + Base_viewPDMFieldLibrary @@ -293,4 +91,17 @@ + + + + + + + + _text + python: [\'base_price\', \'base_unit_price\', \'slice_base_price\', \'slice_quantity_range\'] + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/my_base_price_per_slice.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/my_base_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..570d9bd0ed8a00f0ced261f2061af9d0f38ce191 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/my_base_price_per_slice.xml @@ -0,0 +1,78 @@ + + + + + + + + + + delegated_list + + + + + + id + my_base_price_per_slice + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + field_id + my_base_price_per_slice + + + form_id + Base_viewPDMFieldLibrary + + + + + + + + diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/my_quantity_step_list.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/my_quantity_step_list.xml index 66830bcdb83794d2d9c2eafbd332d4fcd5979a67..b90202d3eb310460248e9153fc5650549e46b424 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/my_quantity_step_list.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_viewBasePrice/my_quantity_step_list.xml @@ -134,9 +134,7 @@ default - - AAAAAAAAAAI= - + description @@ -238,7 +236,7 @@ external_validator - AAAAAAAAAAM= + AAAAAAAAAAI= @@ -300,19 +298,6 @@ - - - - - - - _text - python:[str(x) for x in here.getQuantityStepList()] - - - - - diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow.xml new file mode 100644 index 0000000000000000000000000000000000000000..c21b5f5fafc7aaf78f5181c09b173ae8784faa1b --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow.xml @@ -0,0 +1,46 @@ + + + + + + + + + + _objects + + + + + + creation_guard + + + + + + description + + + + groups + + + + + + id + supply_cell_interaction_workflow + + + manager_bypass + 0 + + + title + Supply Cell Interaction Workflow + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/interactions.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/interactions.xml new file mode 100644 index 0000000000000000000000000000000000000000..e18bf8cbf778a6808aa24ec39bba4b527d7b1bef --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/interactions.xml @@ -0,0 +1,28 @@ + + + + + + + + + + _mapping + + + + + + _objects + + + + + + id + interactions + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/interactions/SupplyCell_updateBasePrice.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/interactions/SupplyCell_updateBasePrice.xml new file mode 100644 index 0000000000000000000000000000000000000000..d7bac054fa1f55b9a97f29a52390e23badda592a --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/interactions/SupplyCell_updateBasePrice.xml @@ -0,0 +1,100 @@ + + + + + + + + + + actbox_category + workflow + + + actbox_name + + + + actbox_url + + + + activate_script_name + + + + + + after_script_name + + + SupplyCell_updateSliceBasePrice + + + + + before_commit_script_name + + + + + + description + + + + guard + + + + + + id + SupplyCell_updateBasePrice + + + method_id + + + _setBasePrice + + + + + once_per_transaction + 0 + + + portal_type_filter + + + + + + portal_type_group_filter + + + + + + script_name + + + + + + temporary_document_disallowed + 0 + + + title + + + + trigger_type + 2 + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts.xml new file mode 100644 index 0000000000000000000000000000000000000000..072c8f6540c07806bee17a34c920ec09b2de1bd5 --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts.xml @@ -0,0 +1,28 @@ + + + + + + + + + + _mapping + + + + + + _objects + + + + + + id + scripts + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts/SupplyCell_updateSliceBasePrice.py b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts/SupplyCell_updateSliceBasePrice.py new file mode 100644 index 0000000000000000000000000000000000000000..7c9e6f711197996d0a211569dbb9c63d482e18ef --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts/SupplyCell_updateSliceBasePrice.py @@ -0,0 +1,24 @@ +supply_cell = state_change['object'] +supply_line = supply_cell.getParentValue() +quantity_criterion_list = [ + criterion for criterion in supply_cell.getCriterionList() + if criterion.property == 'quantity' +] +if len(quantity_criterion_list) == 1: + quantity_criterion = quantity_criterion_list[0] +else: + return +if supply_cell.getParentValue().isBasePricePerSlice(): + quantity_step_list = [None] + supply_line.getQuantityStepList(base_id='path') + [None] + try: + index = quantity_step_list.index(quantity_criterion.min) + 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] + supply_cell.setSliceQuantityRange((min_quantity, max_quantity)) + supply_cell.setSliceBasePrice(supply_cell.getBasePrice()) +else: + supply_cell.setSliceQuantityRange(None) + supply_cell.setSliceBasePrice(None) diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts/SupplyCell_updateSliceBasePrice.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts/SupplyCell_updateSliceBasePrice.xml new file mode 100644 index 0000000000000000000000000000000000000000..518045e7faeb13bd9d8857711d225966899056d7 --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/scripts/SupplyCell_updateSliceBasePrice.xml @@ -0,0 +1,62 @@ + + + + + + + + + + Script_magic + 3 + + + _bind_names + + + + + + + + + + _asgns + + + + name_container + container + + + name_context + context + + + name_m_self + script + + + name_subpath + traverse_subpath + + + + + + + + + + + _params + state_change + + + id + SupplyCell_updateSliceBasePrice + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/variables.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/variables.xml new file mode 100644 index 0000000000000000000000000000000000000000..6ae03699d19840ac42b097dfc0a5f34edd416170 --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/variables.xml @@ -0,0 +1,22 @@ + + + + + + + + + + _mapping + + + + + + id + variables + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/worklists.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/worklists.xml new file mode 100644 index 0000000000000000000000000000000000000000..c3432aa051eac2d67ec0692a384adb38d1b6bac8 --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_cell_interaction_workflow/worklists.xml @@ -0,0 +1,22 @@ + + + + + + + + + + _mapping + + + + + + id + worklists + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/interactions/SupplyLine_changeBasePricePerSlice.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/interactions/SupplyLine_changeBasePricePerSlice.xml new file mode 100644 index 0000000000000000000000000000000000000000..bfce927cd4640a3df9b1c69a39e16d911b007710 --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/interactions/SupplyLine_changeBasePricePerSlice.xml @@ -0,0 +1,100 @@ + + + + + + + + + + actbox_category + workflow + + + actbox_name + + + + actbox_url + + + + activate_script_name + + + + + + after_script_name + + + SupplyLine_updateBasePricePerSlice + + + + + before_commit_script_name + + + + + + description + + + + guard + + + + + + id + SupplyLine_changeBasePricePerSlice + + + method_id + + + _setBasePricePerSlice + + + + + once_per_transaction + 0 + + + portal_type_filter + + + + + + portal_type_group_filter + + + + + + script_name + + + + + + temporary_document_disallowed + 0 + + + title + + + + trigger_type + 2 + + + + + diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePriceCellRange.py b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePriceCellRange.py index f748c72bfa6716fda4de228a5b829a730e0c27ac..31d4cdea28c30a046815d1441fe812ab656103d5 100644 --- a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePriceCellRange.py +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePriceCellRange.py @@ -1,5 +1,9 @@ supply_line = state_change['object'] -price_parameter = 'base_price' + +if supply_line.isBasePricePerSlice(): + price_parameter = 'slice_base_price' +else: + price_parameter = 'base_price' base_id = 'path' supply_line.updateQuantityPredicate(price_parameter) supply_line.updateCellRange(base_id=base_id) diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePricePerSlice.py b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePricePerSlice.py new file mode 100644 index 0000000000000000000000000000000000000000..7e1a5cd9a7ed6cd92a677de55c9736d8b0d9d30a --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePricePerSlice.py @@ -0,0 +1,12 @@ +supply_line = state_change['object'] +to_delete_cell_list = [ + cell for cell in supply_line.getCellIdList(base_id='path') + if hasattr(supply_line, cell) +] +supply_line.manage_delObjects(ids=to_delete_cell_list) +if state_change.kwargs['workflow_method_args'][0]: + price_parameter = 'slice_base_price' +else: + price_parameter = 'base_price' +supply_line.updateQuantityPredicate(price_parameter) +supply_line.updateCellRange(base_id='path') diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePricePerSlice.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePricePerSlice.xml new file mode 100644 index 0000000000000000000000000000000000000000..b3b65d252edddc76484a5152fb09cec28a8b283e --- /dev/null +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/supply_line_interaction_workflow/scripts/SupplyLine_updateBasePricePerSlice.xml @@ -0,0 +1,62 @@ + + + + + + + + + + Script_magic + 3 + + + _bind_names + + + + + + + + + + _asgns + + + + name_container + container + + + name_context + context + + + name_m_self + script + + + name_subpath + traverse_subpath + + + + + + + + + + + _params + state_change + + + id + SupplyLine_updateBasePricePerSlice + + + + + diff --git a/bt5/erp5_pdm/bt/template_portal_type_workflow_chain_list b/bt5/erp5_pdm/bt/template_portal_type_workflow_chain_list index eb4f083b5acee086650ff96c183db68fb4038c51..5a576e0b30121dbdd2cf46826ba0363219ef84f0 100644 --- a/bt5/erp5_pdm/bt/template_portal_type_workflow_chain_list +++ b/bt5/erp5_pdm/bt/template_portal_type_workflow_chain_list @@ -1,5 +1,6 @@ Component | edit_workflow Component | validation_workflow +Internal Supply Cell | supply_cell_interaction_workflow Internal Supply Line | edit_workflow Internal Supply Line | reindex_object_interaction_workflow Internal Supply Line | supply_line_interaction_workflow @@ -9,6 +10,7 @@ Measure | conversion_interaction_workflow Measure | edit_workflow Product | edit_workflow Product | validation_workflow +Purchase Supply Cell | supply_cell_interaction_workflow Purchase Supply Line | edit_workflow Purchase Supply Line | reindex_object_interaction_workflow Purchase Supply Line | supply_line_interaction_workflow @@ -21,6 +23,7 @@ Quantity Unit Conversion Group | conversion_interaction_workflow Quantity Unit Conversion Group | edit_workflow Quantity Unit Conversion Group | validation_workflow Resource Measures Consistency Constraint | dynamic_class_generation_interaction_workflow +Sale Supply Cell | supply_cell_interaction_workflow Sale Supply Line | edit_workflow Sale Supply Line | reindex_object_interaction_workflow Sale Supply Line | supply_line_interaction_workflow @@ -28,6 +31,7 @@ Sale Supply | edit_workflow Sale Supply | validation_workflow Service | edit_workflow Service | validation_workflow +Supply Cell | supply_cell_interaction_workflow Supply Line | edit_workflow Supply Line | reindex_object_interaction_workflow Supply Line | supply_line_interaction_workflow diff --git a/bt5/erp5_pdm/bt/template_workflow_id_list b/bt5/erp5_pdm/bt/template_workflow_id_list index e1960e5977699dfcd2d623ff3e6e82459bdf5565..51ffea691ff5af5c80244649420a0380accd2615 100644 --- a/bt5/erp5_pdm/bt/template_workflow_id_list +++ b/bt5/erp5_pdm/bt/template_workflow_id_list @@ -1,3 +1,4 @@ conversion_interaction_workflow +supply_cell_interaction_workflow supply_line_interaction_workflow transformation_interaction_workflow \ No newline at end of file diff --git a/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_internal_supply_line_price_per_slice.xml b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_internal_supply_line_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..22bd9be5474b26e29fabf332c01cd9c9cc540b3e --- /dev/null +++ b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_internal_supply_line_price_per_slice.xml @@ -0,0 +1,58 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + name_subpath + traverse_subpath + + + + + + + + + + + content_type + text/html + + + expand + 0 + + + id + resource_default_internal_supply_line_price_per_slice + + + output_encoding + utf-8 + + + title + + + + + + diff --git a/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_internal_supply_line_price_per_slice.zpt b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_internal_supply_line_price_per_slice.zpt new file mode 100644 index 0000000000000000000000000000000000000000..dab1a253abb525f4fdc659e11a20827426e9a7ca --- /dev/null +++ b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_internal_supply_line_price_per_slice.zpt @@ -0,0 +1,165 @@ + +Test toggling price per slice updates internal supply cells correctly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Test toggling price per slice updates internal supply cells correctly +
clickAndWaitlink=Internal
typefield_my_internal_supply_line_base_unit_price0.00001
typefield_my_internal_supply_line_quantity_step_list11
21
clickAndWaitBase_edit:method
assertTextfield_my_internal_supply_line_quantity_step_list11.0 +21.0
assertText//input[@name="field_matrixbox_base_price_cell_0_0_0"]/../../../td[1]Quantity < 11.0
assertText//input[@name="field_matrixbox_base_price_cell_1_0_0"]/../../../td[1]11.0 <= Quantity < 21.0
assertText//input[@name="field_matrixbox_base_price_cell_2_0_0"]/../../../td[1]21.0 <= Quantity
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
open${base_url}/product_module/erp5_pdm_ui_test_product
clickAndWaitlink=Internal
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9.66667
open${base_url}/product_module/erp5_pdm_ui_test_product
clickAndWaitlink=Internal
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
+ + \ No newline at end of file diff --git a/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_purchase_supply_line_price_per_slice.xml b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_purchase_supply_line_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..2e34bd9d46dec162a248139fe48c6016cc724a42 --- /dev/null +++ b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_purchase_supply_line_price_per_slice.xml @@ -0,0 +1,58 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + name_subpath + traverse_subpath + + + + + + + + + + + content_type + text/html + + + expand + 0 + + + id + resource_default_purchase_supply_line_price_per_slice + + + output_encoding + utf-8 + + + title + + + + + + diff --git a/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_purchase_supply_line_price_per_slice.zpt b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_purchase_supply_line_price_per_slice.zpt new file mode 100644 index 0000000000000000000000000000000000000000..ecd8021a8b2d3f339e0465cf90b2875b34b9e4a5 --- /dev/null +++ b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_purchase_supply_line_price_per_slice.zpt @@ -0,0 +1,165 @@ + +Test toggling price per slice updates purchase supply cells correctly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Test toggling price per slice updates purchase supply cells correctly +
clickAndWaitlink=Purchase
typefield_my_purchase_supply_line_base_unit_price0.00001
typefield_my_purchase_supply_line_quantity_step_list11
21
clickAndWaitBase_edit:method
assertTextfield_my_purchase_supply_line_quantity_step_list11.0 +21.0
assertText//input[@name="field_matrixbox_base_price_cell_0_0_0"]/../../../td[1]Quantity < 11.0
assertText//input[@name="field_matrixbox_base_price_cell_1_0_0"]/../../../td[1]11.0 <= Quantity < 21.0
assertText//input[@name="field_matrixbox_base_price_cell_2_0_0"]/../../../td[1]21.0 <= Quantity
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
open${base_url}/product_module/erp5_pdm_ui_test_product
clickAndWaitlink=Purchase
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9.66667
open${base_url}/product_module/erp5_pdm_ui_test_product
clickAndWaitlink=Purchase
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
+ + \ No newline at end of file diff --git a/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_sale_supply_line_price_per_slice.xml b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_sale_supply_line_price_per_slice.xml new file mode 100644 index 0000000000000000000000000000000000000000..fdd2e659a8009d6c5b93477518335542bf42e12b --- /dev/null +++ b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_sale_supply_line_price_per_slice.xml @@ -0,0 +1,58 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + name_subpath + traverse_subpath + + + + + + + + + + + content_type + text/html + + + expand + 0 + + + id + resource_default_sale_supply_line_price_per_slice + + + output_encoding + utf-8 + + + title + + + + + + diff --git a/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_sale_supply_line_price_per_slice.zpt b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_sale_supply_line_price_per_slice.zpt new file mode 100644 index 0000000000000000000000000000000000000000..ad37630ad465b402139d9cbe2c0af5dfe2a98bd0 --- /dev/null +++ b/bt5/erp5_pdm_ui_test/PathTemplateItem/portal_tests/pdm_zuite/resource_default_sale_supply_line_price_per_slice.zpt @@ -0,0 +1,165 @@ + +Test toggling price per slice updates sale supply cells correctly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Test toggling price per slice updates sale supply cells correctly +
clickAndWaitlink=Sale
typefield_my_sale_supply_line_base_unit_price0.00001
typefield_my_sale_supply_line_quantity_step_list11
21
clickAndWaitBase_edit:method
assertTextfield_my_sale_supply_line_quantity_step_list11.0 +21.0
assertText//input[@name="field_matrixbox_base_price_cell_0_0_0"]/../../../td[1]Quantity < 11.0
assertText//input[@name="field_matrixbox_base_price_cell_1_0_0"]/../../../td[1]11.0 <= Quantity < 21.0
assertText//input[@name="field_matrixbox_base_price_cell_2_0_0"]/../../../td[1]21.0 <= Quantity
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
open${base_url}/product_module/erp5_pdm_ui_test_product
clickAndWaitlink=Sale
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9.66667
open${base_url}/product_module/erp5_pdm_ui_test_product
clickAndWaitlink=Sale
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
+ + \ No newline at end of file diff --git a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_CommonTemplate.zpt b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_CommonTemplate.zpt index fa6672bb7329d0f2e15ee49f9813a10c0f25cd5f..c00be97db8f152b1636fa728606a8de54f647583 100644 --- a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_CommonTemplate.zpt +++ b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_CommonTemplate.zpt @@ -71,4 +71,82 @@ + + + click + //input[@name="field_my_sale_supply_line_base_price_per_slice"] + + + + clickAndWait + Base_edit:method + + + + + + click + //input[@name="field_my_purchase_supply_line_base_price_per_slice"] + + + + clickAndWait + Base_edit:method + + + + + + click + //input[@name="field_my_internal_supply_line_base_price_per_slice"] + + + + clickAndWait + Base_edit:method + + + + + + type + //input[@name="field_matrixbox_base_price_cell_0_0_0"] + 10 + + + type + //input[@name="field_matrixbox_base_price_cell_1_0_0"] + 9 + + + type + //input[@name="field_matrixbox_base_price_cell_2_0_0"] + 8 + + + clickAndWait + Base_edit:method + + + + assertFloatValue + //input[@name="field_matrixbox_base_price_cell_0_0_0"] + 10 + + + assertFloatValue + //input[@name="field_matrixbox_base_price_cell_1_0_0"] + 9 + + + assertFloatValue + //input[@name="field_matrixbox_base_price_cell_2_0_0"] + 8 + + + open + ${base_url}/Zuite_waitForActivities + + + \ No newline at end of file diff --git a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.py b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.py index 2c79955dc6d90973306d7b6a186efcd1e0beaf09..a977df89c3b966770b5f7c907ee8edc63f1bb0e7 100644 --- a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.py +++ b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.py @@ -1,10 +1,10 @@ from DateTime import DateTime portal = context.getPortalObject() -order_portal_type = "Sale Order" -order_line_portal_type = "Sale Order Line" -delivery_portal_type = "Sale Packing List" -delivery_line_portal_type = "Sale Packing List Line" +order_portal_type = "%s Order" % delivery_type +order_line_portal_type = "%s Order Line" % delivery_type +delivery_portal_type = "%s Packing List" % delivery_type +delivery_line_portal_type = "%s Packing List Line" % delivery_type delivery_id = "erp5_pdm_ui_test_delivery" delivery_title = "erp5_pdm_ui_test_delivery_title" @@ -13,10 +13,19 @@ source_node_id = "erp5_pdm_ui_test_source_node" destination_node_id = "erp5_pdm_ui_test_destination_node" resource_id = "erp5_pdm_ui_test_product" -business_process = 'business_process_module/erp5_default_business_process' +business_process_id = 'erp5_default_business_process' quantity = 1 +business_process_module = portal.getDefaultModule("Business Process") +business_process = getattr(business_process_module, business_process_id, None) +if business_process is None: + business_process = business_process_module.newContent( + portal_type="Business Process", + id=business_process_id, + reference=business_process_id, + ) + # Create an order or a packing list if state in ['planned', 'ordered']: module = portal.getDefaultModule(order_portal_type) @@ -28,7 +37,7 @@ if state in ['planned', 'ordered']: source_section='organisation_module/%s' % source_node_id, destination='organisation_module/%s' % destination_node_id, destination_section='organisation_module/%s' % destination_node_id, - specialise=business_process, + specialise_value=business_process, start_date=DateTime(), ) order_line = order.newContent( @@ -51,7 +60,7 @@ else: source_section='organisation_module/%s' % source_node_id, destination='organisation_module/%s' % destination_node_id, destination_section='organisation_module/%s' % destination_node_id, - specialise=business_process, + specialise_value=business_process, start_date=DateTime(), ) delivery_line = delivery.newContent( diff --git a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.xml b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.xml index 3231e0a0138041fec5baa04d36d3852bae47d749..dfc15c33eee4627c42c65db1ea99050babccf3f6 100644 --- a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.xml +++ b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_createDelivery.xml @@ -50,7 +50,7 @@
_params - state + state, delivery_type="Sale" id diff --git a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_deleteData.py b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_deleteData.py index a0d44eb3cd0435a96cf279cb505ee2aab806c2ca..c6f866066ceea1f64afa9c6da47f5056f7379a70 100644 --- a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_deleteData.py +++ b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_deleteData.py @@ -4,9 +4,6 @@ resource_portal_type = "Product" node_portal_type = "Organisation" site_portal_type = "Category" -order_portal_type = "Sale Order" -delivery_portal_type = "Sale Packing List" - resource_id = "erp5_pdm_ui_test_product" source_node_id = "erp5_pdm_ui_test_source_node" @@ -35,18 +32,22 @@ for site_id in (source_site_id, destination_site_id): base_category.manage_delObjects([site_id]) stool = portal.portal_simulation -# Delete order -module = portal.getDefaultModule(order_portal_type) -if getattr(module, delivery_id, None) is not None: - delivery = getattr(module, delivery_id) - stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule')) - module.manage_delObjects([delivery_id]) - -# Delete delivery -module = portal.getDefaultModule(delivery_portal_type) -if getattr(module, delivery_id, None) is not None: - delivery = getattr(module, delivery_id) - stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule')) - module.manage_delObjects([delivery_id]) +for delivery_type in ("Internal", "Purchase", "Sale"): + order_portal_type = delivery_type + " Order" + delivery_portal_type = delivery_type + " Packing List" + + # Delete order + module = portal.getDefaultModule(order_portal_type) + if getattr(module, delivery_id, None) is not None: + delivery = getattr(module, delivery_id) + stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule')) + module.manage_delObjects([delivery_id]) + + # Delete delivery + module = portal.getDefaultModule(delivery_portal_type) + if getattr(module, delivery_id, None) is not None: + delivery = getattr(module, delivery_id) + stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule')) + module.manage_delObjects([delivery_id]) return "Deleted Successfully." diff --git a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_reset.py b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_reset.py index 7ff690dceb639cb5f3d008c1c905a80e07c098f6..aade9d91d9b8c6ffd7fbcf58078b028af6e7ef0d 100644 --- a/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_reset.py +++ b/bt5/erp5_pdm_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_ui_test/PdmZuite_reset.py @@ -15,18 +15,28 @@ source_site_title = "erp5_pdm_ui_test_source_site_title" destination_site_id = "erp5_pdm_ui_test_destination_site" destination_site_title = "erp5_pdm_ui_test_destination_site_title" +quantity_unit_category = portal.portal_categories.quantity_unit + # validate rules for rule in portal.portal_rules.objectValues(): if rule.getValidationState() != 'validated': rule.validate() # Create resource +if getattr(quantity_unit_category, "unit", None) is None: + quantity_unit_category.newContent( + portal_type="Category", + id="unit" + ) module = portal.getDefaultModule(resource_portal_type) + resource = module.newContent( portal_type=resource_portal_type, id=resource_id, - title=resource_title + title=resource_title, + quantity_unit='unit', ) +resource.validate() # Create site categories base_category = portal.restrictedTraverse('portal_categories/site') diff --git a/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testInternalSupplyLinePricePerSlice.xml b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testInternalSupplyLinePricePerSlice.xml new file mode 100644 index 0000000000000000000000000000000000000000..af49321d23dd6443204928f82d13a6359cdfb752 --- /dev/null +++ b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testInternalSupplyLinePricePerSlice.xml @@ -0,0 +1,58 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + name_subpath + traverse_subpath + + + + + + + + + + + content_type + text/html + + + expand + 0 + + + id + testInternalSupplyLinePricePerSlice + + + output_encoding + utf-8 + + + title + + + + + + diff --git a/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testInternalSupplyLinePricePerSlice.zpt b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testInternalSupplyLinePricePerSlice.zpt new file mode 100644 index 0000000000000000000000000000000000000000..2ff7ac919b6bc3df1ccbceb1f7fb21fef0edba60 --- /dev/null +++ b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testInternalSupplyLinePricePerSlice.zpt @@ -0,0 +1,217 @@ + +Test toggling price per slice updates internal supply cells correctly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Test quantity steps for price on internal supply line +
open${base_url}/Zuite_deleteDataForTradeZuite
assertTextPresentDeleted Successfully.
open${base_url}/Zuite_waitForActivities
assertTextPresentDone.
open${base_url}/Zuite_resetForTradeZuite
assertTextPresentReset Successfully.
open +
assertTextPresentInternal Trade Condition Created.
open${base_url}/Zuite_waitForActivities
assertTextPresentDone.
open +
typefield_my_base_unit_price0.00001
clickAndWaitBase_edit:method
clickAndWaitlink=Base Price
typefield_my_quantity_step_list11
21
clickAndWaitBase_edit:method
assertTextfield_my_quantity_step_list11.0 21.0
assertText//input[@name="field_matrixbox_base_price_cell_0_0_0"]/../../../td[1]Quantity < 11.0
assertText//input[@name="field_matrixbox_base_price_cell_1_0_0"]/../../../td[1]11.0 <= Quantity < 21.0
assertText//input[@name="field_matrixbox_base_price_cell_2_0_0"]/../../../td[1]21.0 <= Quantity
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
open${base_url}/internal_trade_condition_module/erp5_trade_ui_test_trade_condition/1/InternalSupplyLine_viewBasePrice
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9.66667
open${base_url}/internal_trade_condition_module/erp5_trade_ui_test_trade_condition/1/InternalSupplyLine_viewBasePrice
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
+ + \ No newline at end of file diff --git a/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testPurchaseSupplyLinePricePerSlice.xml b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testPurchaseSupplyLinePricePerSlice.xml new file mode 100644 index 0000000000000000000000000000000000000000..5c731f0d8f625c88d52f8686bcb62d134c71bd3b --- /dev/null +++ b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testPurchaseSupplyLinePricePerSlice.xml @@ -0,0 +1,58 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + name_subpath + traverse_subpath + + + + + + + + + + + content_type + text/html + + + expand + 0 + + + id + testPurchaseSupplyLinePricePerSlice + + + output_encoding + utf-8 + + + title + + + + + + diff --git a/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testPurchaseSupplyLinePricePerSlice.zpt b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testPurchaseSupplyLinePricePerSlice.zpt new file mode 100644 index 0000000000000000000000000000000000000000..e2520d860b1395ba440ed8bac1c0de0ff153f3a9 --- /dev/null +++ b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testPurchaseSupplyLinePricePerSlice.zpt @@ -0,0 +1,217 @@ + +Test toggling price per slice updates purchase supply cells correctly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Test quantity steps for price on purchase supply line +
open${base_url}/Zuite_deleteDataForTradeZuite
assertTextPresentDeleted Successfully.
open${base_url}/Zuite_waitForActivities
assertTextPresentDone.
open${base_url}/Zuite_resetForTradeZuite
assertTextPresentReset Successfully.
open +
assertTextPresentPurchase Trade Condition Created.
open${base_url}/Zuite_waitForActivities
assertTextPresentDone.
open +
typefield_my_base_unit_price0.00001
clickAndWaitBase_edit:method
clickAndWaitlink=Base Price
typefield_my_quantity_step_list11
21
clickAndWaitBase_edit:method
assertTextfield_my_quantity_step_list11.0 21.0
assertText//input[@name="field_matrixbox_base_price_cell_0_0_0"]/../../../td[1]Quantity < 11.0
assertText//input[@name="field_matrixbox_base_price_cell_1_0_0"]/../../../td[1]11.0 <= Quantity < 21.0
assertText//input[@name="field_matrixbox_base_price_cell_2_0_0"]/../../../td[1]21.0 <= Quantity
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
open${base_url}/purchase_trade_condition_module/erp5_trade_ui_test_trade_condition/1/PurchaseSupplyLine_viewBasePrice
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9.66667
open${base_url}/purchase_trade_condition_module/erp5_trade_ui_test_trade_condition/1/PurchaseSupplyLine_viewBasePrice
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
+ + \ No newline at end of file diff --git a/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testSaleSupplyLinePricePerSlice.xml b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testSaleSupplyLinePricePerSlice.xml new file mode 100644 index 0000000000000000000000000000000000000000..87d10b4296acfd9907411e7269c084daad3f6a96 --- /dev/null +++ b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testSaleSupplyLinePricePerSlice.xml @@ -0,0 +1,58 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + name_subpath + traverse_subpath + + + + + + + + + + + content_type + text/html + + + expand + 0 + + + id + testSaleSupplyLinePricePerSlice + + + output_encoding + utf-8 + + + title + + + + + + diff --git a/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testSaleSupplyLinePricePerSlice.zpt b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testSaleSupplyLinePricePerSlice.zpt new file mode 100644 index 0000000000000000000000000000000000000000..cee7bc88cb5a0bbf596cedbf16d2a6e016737be4 --- /dev/null +++ b/bt5/erp5_trade_ui_test/PathTemplateItem/portal_tests/trade_zuite/testSaleSupplyLinePricePerSlice.zpt @@ -0,0 +1,216 @@ + +Test toggling price per slice updates sale supply cells correctly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Test quantity steps for price on sale supply line +
open${base_url}/Zuite_deleteDataForTradeZuite
assertTextPresentDeleted Successfully.
open${base_url}/Zuite_waitForActivities
assertTextPresentDone.
open${base_url}/Zuite_resetForTradeZuite
assertTextPresentReset Successfully.
open +
assertTextPresentSale Trade Condition Created.
open${base_url}/Zuite_waitForActivities
assertTextPresentDone.
open +
typefield_my_base_unit_price0.00001
clickAndWaitBase_edit:method
clickAndWaitlink=Base Price
typefield_my_quantity_step_list11
21
clickAndWaitBase_edit:method
assertTextfield_my_quantity_step_list11.0 21.0
assertText//input[@name="field_matrixbox_base_price_cell_0_0_0"]/../../../td[1]Quantity < 11.0
assertText//input[@name="field_matrixbox_base_price_cell_1_0_0"]/../../../td[1]11.0 <= Quantity < 21.0
assertText//input[@name="field_matrixbox_base_price_cell_2_0_0"]/../../../td[1]21.0 <= Quantity
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
open${base_url}/sale_trade_condition_module/erp5_trade_ui_test_trade_condition/1/SaleSupplyLine_viewBasePrice
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9.66667
open${base_url}/sale_trade_condition_module/erp5_trade_ui_test_trade_condition/1/SaleSupplyLine_viewBasePrice
open +
type//input[@name="field_my_quantity"]15
type//input[@name="field_my_price"]
clickAndWaitBase_edit:method
assertFloatValue//input[@name="field_my_price"]9
+ + \ No newline at end of file diff --git a/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_CommonTemplateForTradeZuite.zpt b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_CommonTemplateForTradeZuite.zpt index a7905788d7f57bb9718a11e2d6284120a8abe012..53903945efa713075181cf9296da1bee7a96bfbb 100644 --- a/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_CommonTemplateForTradeZuite.zpt +++ b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_CommonTemplateForTradeZuite.zpt @@ -66,4 +66,16 @@ + + + click + //input[@name="field_my_base_price_per_slice"] + + + + clickAndWait + Base_edit:method + + + \ No newline at end of file diff --git a/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_createTradeConditionForTradeZuite.py b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_createTradeConditionForTradeZuite.py new file mode 100644 index 0000000000000000000000000000000000000000..cd48c3ad6bb461c91089c659e03d1db04451c516 --- /dev/null +++ b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_createTradeConditionForTradeZuite.py @@ -0,0 +1,36 @@ +from DateTime import DateTime + +portal = context.getPortalObject() +trade_condition_portal_type = "%s Trade Condition" % delivery_type +supply_line_portal_type = "%s Supply Line" % delivery_type + +trade_condition_id = "erp5_trade_ui_test_trade_condition" +trade_condition_title = "erp5_trade_ui_test_trade_condition_title" + +resource_id = "erp5_pdm_ui_test_product" + +delivery_portal_type = "%s Packing List" % delivery_type + +# Create Trade Condition +module = portal.getDefaultModule(trade_condition_portal_type) +trade_condition = module.newContent( + portal_type=trade_condition_portal_type, + id=trade_condition_id, + title=trade_condition_title, +) +trade_condition.newContent( + portal_type=supply_line_portal_type, + resource="product_module/" + resource_id +) + +trade_condition.validate() + +# Set it as specialise to the Delivery created by PdmZuite_createDelivery +module = portal.getDefaultModule(delivery_portal_type) +delivery = getattr(module, "erp5_pdm_ui_test_delivery", None) +if delivery is not None: + delivery.setSpecialiseValue(trade_condition) +else: + raise ValueError('Delivery not found') + +return trade_condition_portal_type + " Created." diff --git a/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_createTradeConditionForTradeZuite.xml b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_createTradeConditionForTradeZuite.xml new file mode 100644 index 0000000000000000000000000000000000000000..cfa80c3f46e553fcaa65d3c7ce93af0f7742b3fd --- /dev/null +++ b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_createTradeConditionForTradeZuite.xml @@ -0,0 +1,62 @@ + + + + + + + + + + Script_magic + 3 + + + _bind_names + + + + + + + + + + _asgns + + + + name_container + container + + + name_context + context + + + name_m_self + script + + + name_subpath + traverse_subpath + + + + + + + + + + + _params + delivery_type="Sale" + + + id + Zuite_createTradeConditionForTradeZuite + + + + + diff --git a/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_deleteDataForTradeZuite.py b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_deleteDataForTradeZuite.py index 5981506d99e052c23ece1f93a3f8e057ec83ecf4..ebeb22e2776648a5d401b2420329f7c9bc43f6ae 100644 --- a/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_deleteDataForTradeZuite.py +++ b/bt5/erp5_trade_ui_test/SkinTemplateItem/portal_skins/erp5_trade_ui_test/Zuite_deleteDataForTradeZuite.py @@ -1,5 +1,15 @@ -try: - context.sale_order_module.manage_delObjects(ids=['erp5_trade_ui_test_sale_order_1']) -except: - pass +portal = context.getPortalObject() + +object_value_list = [ + getattr(context.sale_order_module, 'erp5_trade_ui_test_sale_order_1', None) +] + [ + getattr(portal.getDefaultModule(portal_type), "erp5_trade_ui_test_trade_condition", None) + for portal_type in ("Internal Trade Condition", "Purchase Trade Condition", "Sale Trade Condition") +] + +for object_value in object_value_list: + if object_value is None: + continue + object_value.getParentValue().manage_delObjects(ids=[object_value.getId()]) + return "Deleted Successfully." diff --git a/bt5/erp5_trade_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalTrade.py b/bt5/erp5_trade_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalTrade.py new file mode 100644 index 0000000000000000000000000000000000000000..584f1b14eb74e7100f9c0828b460586bd44553de --- /dev/null +++ b/bt5/erp5_trade_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalTrade.py @@ -0,0 +1,40 @@ +############################################################################## +# +# Copyright (c) 2017 Nexedi SARL and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## +import unittest + +from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase + + +class TestFunctionalPDM(ERP5TypeFunctionalTestCase): + foreground = 0 + run_only = "trade_zuite" + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestFunctionalPDM)) + return suite \ No newline at end of file diff --git a/bt5/erp5_trade_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalTrade.xml b/bt5/erp5_trade_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalTrade.xml new file mode 100644 index 0000000000000000000000000000000000000000..f203e24d4fbc720a96d2e553afd313b89c497ad0 --- /dev/null +++ b/bt5/erp5_trade_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalTrade.xml @@ -0,0 +1,121 @@ + + + + + + + + + + _recorded_property_dict + + AAAAAAAAAAI= + + + + default_reference + testFunctionalTrade + + + description + Run UI tests for Trade + + + id + test.erp5.testFunctionalTrade + + + portal_type + Test Component + + + sid + + + + + + text_content_error_message + + + + + + text_content_warning_message + + + + + + version + erp5 + + + workflow_history + + AAAAAAAAAAM= + + + + + + + + + + + + + data + + + + + + + + + + + + + + + data + + + + component_validation_workflow + + AAAAAAAAAAQ= + + + + + + + + + + + + + + + + + + + action + validate + + + validation_state + validated + + + + + + + diff --git a/bt5/erp5_trade_ui_test/bt/dependency_list b/bt5/erp5_trade_ui_test/bt/dependency_list index 5e5fa6d21607f3fd9251edbf97b3a8d8564fdf77..3d1caabb4e235985a5313381eb404b7f7dbb0f85 100644 --- a/bt5/erp5_trade_ui_test/bt/dependency_list +++ b/bt5/erp5_trade_ui_test/bt/dependency_list @@ -1,2 +1,3 @@ +erp5_pdm_ui_test erp5_trade erp5_ui_test \ No newline at end of file diff --git a/bt5/erp5_trade_ui_test/bt/template_test_id_list b/bt5/erp5_trade_ui_test/bt/template_test_id_list new file mode 100644 index 0000000000000000000000000000000000000000..2f3b7557e5ff54dea07095e91a407cb4608d6403 --- /dev/null +++ b/bt5/erp5_trade_ui_test/bt/template_test_id_list @@ -0,0 +1 @@ +test.erp5.testFunctionalTrade \ No newline at end of file diff --git a/bt5/erp5_trade_ui_test/bt/test_dependency_list b/bt5/erp5_trade_ui_test/bt/test_dependency_list new file mode 100644 index 0000000000000000000000000000000000000000..bff77e32d84989312efdf3b2caed2e39f9a513ed --- /dev/null +++ b/bt5/erp5_trade_ui_test/bt/test_dependency_list @@ -0,0 +1 @@ +erp5_full_text_mroonga_catalog \ No newline at end of file diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py index 6ca3463e1f59d850f4d04b3c65f37ede528e9283..6df731c5f89851c3ecd6e6a16c37f336be36e8c6 100644 --- a/product/ERP5/Document/Resource.py +++ b/product/ERP5/Document/Resource.py @@ -712,6 +712,8 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin): 'non_discountable_additional_price': [], 'priced_quantity': None, 'base_unit_price': None, + 'slice_base_price': [], + 'slice_quantity_range': [], } if mapped_value is None: return price_parameter_dict diff --git a/product/ERP5/Document/SupplyLine.py b/product/ERP5/Document/SupplyLine.py index fc7ba6fc5a79ae121d15497a7be7c3b9c243ccd4..a24dd685d2a33572fa47b0675772eb9923562242 100644 --- a/product/ERP5/Document/SupplyLine.py +++ b/product/ERP5/Document/SupplyLine.py @@ -153,7 +153,7 @@ class SupplyLine(Path, Amount, XMLMatrix): Return predicate id related to a price parameter. """ predicate_id_start_with = "quantity_range_" - if price_parameter != "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 @@ -183,12 +183,12 @@ class SupplyLine(Path, Amount, XMLMatrix): """ # We need to keep compatibility with generated accessor price_parameter = kw.get('price_parameter', "base_price") - if price_parameter == "base_price": + if price_parameter in ("base_price", "slice_base_price"): method_name = "_baseGetQuantityStepList" else: method_name = 'get%sList' % \ convertToUpperCase("%s_quantity_step" % price_parameter) - return getattr(self, method_name)() + return getattr(self, method_name)() or [] security.declareProtected(Permissions.ModifyPortalContent, 'updateQuantityPredicate') @@ -208,7 +208,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 != "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): @@ -218,7 +218,11 @@ class SupplyLine(Path, Amount, XMLMatrix): p = self.newContent(id='%s_%s' % (predicate_id_start_with, str(i)), portal_type='Predicate', int_index=i+1) p.setCriterionPropertyList(('quantity', )) - p.setCriterion('quantity', min=min_quantity, max=max_quantity) + p.setCriterion( + 'quantity', + min=min_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) p.setTitle(title) diff --git a/product/ERP5/Tool/DomainTool.py b/product/ERP5/Tool/DomainTool.py index 7ed2ea48d13e99caea59db3a8c981f76a2dd3b4e..ef2c153d19379a895abe8e15a51dbb27c9e9c45b 100644 --- a/product/ERP5/Tool/DomainTool.py +++ b/product/ERP5/Tool/DomainTool.py @@ -303,7 +303,7 @@ class DomainTool(BaseTool): # (some users are not able to see resource's price) security.declarePublic('generateMultivaluedMappedValue') def generateMultivaluedMappedValue(self, context, test=1, - predicate_list=None, explanation_only=0, **kw): + predicate_list=None, **kw): """ We will generate a mapped value with the list of all predicates found. @@ -320,22 +320,13 @@ class DomainTool(BaseTool): if predicate_list: from Products.ERP5Type.Document import newTempSupplyCell mapped_value_property_dict = defaultdict(list) - explanation_dict = defaultdict(dict) # Look for each property the first predicate with unique criterion # categories which defines the property for predicate in predicate_list: - full_prop_dict = explanation_dict[ - tuple(predicate.getMembershipCriterionCategoryList())] for mapped_value_property in predicate.getMappedValuePropertyList(): - if mapped_value_property in full_prop_dict: - # we already have one value for this (categories, property) - continue value = predicate.getProperty(mapped_value_property) if value is not None: - full_prop_dict[mapped_value_property] = value mapped_value_property_dict[mapped_value_property].append(value) - if explanation_only: - return dict(explanation_dict) mapped_value = newTempSupplyCell(self.getPortalObject(), 'multivalued_mapped_value') mapped_value._setMappedValuePropertyList( diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/internal_supply_line_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/internal_supply_line_property.xml index 96d56e2af2bdb09e43dc399128285f3a4c4e8bf1..c5ebd794085c5eb2acc5b99f2c065aa334200a57 100644 --- a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/internal_supply_line_property.xml +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/internal_supply_line_property.xml @@ -54,6 +54,7 @@ base_price + base_price_per_slice id priced_quantity price_currency diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/purchase_supply_line_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/purchase_supply_line_property.xml index d0b66bfb2d847586dae746ce29220e14f144424e..3d2809a838304ff78ddb1ea5412fb8914e6f5d55 100644 --- a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/purchase_supply_line_property.xml +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/purchase_supply_line_property.xml @@ -54,6 +54,7 @@ base_price + base_price_per_slice id priced_quantity price_currency diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/sale_supply_line_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/sale_supply_line_property.xml index 6164f6c5b5f7ff33badbadd9fa8c9ab287355cd0..7769d00b704655a6a0e29c70391139926e3a5fd1 100644 --- a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/sale_supply_line_property.xml +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/sale_supply_line_property.xml @@ -54,6 +54,7 @@ base_price + base_price_per_slice id priced_quantity price_currency diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/supply_line_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/supply_line_property.xml index 6640006de4285116f52f3a312ed08b202763d175..15d59f1b330a3b9f2ff2a1670ca6f3b0fcc40316 100644 --- a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/supply_line_property.xml +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/DefaultSupply/supply_line_property.xml @@ -36,6 +36,7 @@ base_price + base_price_per_slice id priced_quantity price_currency diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/base_price_per_slice_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/base_price_per_slice_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..c3d8bfafcdef7db669fe5bfdf0fb01dc8132ee8e --- /dev/null +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/base_price_per_slice_property.xml @@ -0,0 +1,39 @@ + + + + + + + + + + categories + + + elementary_type/boolean + + + + + description + 10 products cost 10$, and 11->infinity products cost 9$, in a order of 15 products, the unit base price is 9.6667$, as the 10 first products cost 10$, and the 5 others cost 9$ (and (10*10+5*9)/15 = 9.6667) + +]]> + + + id + base_price_per_slice_property + + + portal_type + Standard Property + + + + + diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_base_price_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_base_price_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..b53bc82859f848b71cc929ab6904bf8598e9fe5a --- /dev/null +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_base_price_property.xml @@ -0,0 +1,60 @@ + + + + + + + + + + _local_properties + + + + + id + mode + + + type + string + + + + + + + categories + + + elementary_type/object + + + + + description + A per unit base price applying to the products whose quantity is in slice. This per unit base price will be weighted with the per unit base price of other slices.\n +\n +This property is useful for the following case :\n +0-10 products cost 10$, and 11-inf products cost 9$. Thus in a order of 15 products, the unit base price is 9.6667$, as 10 * 10 + 5 * 9 = 145, and 145 / 15 = 9.6667 + + + id + slice_base_price_property + + + mode + w + + + multivalued + 0 + + + portal_type + Standard Property + + + + + diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_quantity_range_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_quantity_range_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..4e8b4509b08351ce11eb4a77aaa17a4792729524 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_quantity_range_property.xml @@ -0,0 +1,59 @@ + + + + + + + + + + _local_properties + + + + + id + mode + + + type + string + + + + + + + categories + + + elementary_type/object + + + + + description + quantiy range of the items for which the slice_base_price will be applied if base_price_per_slice is True.\n +\n +slice_quantity_range is a 2-tuple : (min_bound, max_bound) + + + id + slice_quantity_range_property + + + mode + w + + + multivalued + 0 + + + portal_type + Standard Property + + + + + diff --git a/product/ERP5/tests/testResource.py b/product/ERP5/tests/testResource.py index 19adf1b9fe66510a931e2bfa667f64868d9945c5..8b39ac952b7082feea4e2da9a55bd54b02ed3933 100644 --- a/product/ERP5/tests/testResource.py +++ b/product/ERP5/tests/testResource.py @@ -1127,6 +1127,115 @@ class TestResource(ERP5TypeTestCase): # resource_b is member of product_line/b, so our supply line does not apply. self.assertEqual(None, sale_order_line.getPrice()) + def testGetPriceWithBasePriceDefinedPerSlice(self): + """ + Slices allow to apply a different price per item given the quantity of this + item ordered. See exemple + [unit quantity] [price defined for the units of this slice] + 0 -> 10 = 10 currency/unit + 11 -> 20 = 9 currency/unit + 21 -> inf = 8 currency/unit + + So the price for an order of X unit is : + unit -> total order price -> price / unit + 9 -> 90 currency -> 10 currency/unit + 15 -> 10*10+5*9 = 145 currency -> 9.66667 currency/unit + 25 -> 20*10+10*9+5*8 = 230 currency -> 9.2 currency/unit + """ + product_module = self.portal.getDefaultModule(self.product_portal_type) + product = product_module.newContent( + portal_type=self.product_portal_type, + title='FakeProduct' + ) + product.validate() + + sale_supply = self.portal.getDefaultModule( + self.sale_supply_portal_type + ).newContent( + self.sale_supply_portal_type, + base_price_per_slice=True, + ) + + supply_line = sale_supply.newContent( + portal_type=self.sale_supply_line_portal_type, + resource_value=product, + base_unit_price=0.00001, + ) + supply_line.setQuantityStepList((11, 21)) + supply_line.updateCellRange() + + cell0 = supply_line.newContent( + portal_type=self.sale_supply_cell_portal_type, + id='path_0', + slice_base_price=10., + slice_quantity_range=(1, 11), + ) + cell0.setCriterionPropertyList(('quantity', )) + cell0.setCriterion('quantity', min=1, max=None) + cell0.setMappedValuePropertyList( + ["slice_base_price", "slice_quantity_range", "base_price", "base_unit_price"] + ) + + cell1 = supply_line.newContent( + portal_type=self.sale_supply_cell_portal_type, + id='path_1', + slice_base_price=9., + slice_quantity_range=(11, 21), + ) + cell1.setCriterionPropertyList(('quantity', )) + cell1.setCriterion('quantity', min=11, max=None) + cell1.setMappedValuePropertyList( + ["slice_base_price", "slice_quantity_range", "base_price", "base_unit_price"] + ) + + cell2 = supply_line.newContent( + portal_type=self.sale_supply_cell_portal_type, + id='path_2', + slice_base_price=8., + slice_quantity_range=(21, None), + ) + cell2.setCriterionPropertyList(('quantity', )) + cell2.setCriterion('quantity', min=21, max=None) + cell2.setMappedValuePropertyList( + ["slice_base_price", "slice_quantity_range", "base_price", "base_unit_price"] + ) + + sale_supply.validate() + self.tic() + + currency_module = self.portal.getDefaultModule("Currency") + currency = currency_module.newContent( + portal_type="Currency", + title='Euro', + base_unit_quantity=0.01, + ) + + sale_order = self.portal.getDefaultModule("Sale Order").newContent( + portal_type='Sale Order', + specialise_value=sale_supply, + resource_value=currency, + ) + + def _test(quantity, price, total_price): + sale_order_line = sale_order.newContent( + portal_type=self.sale_order_line_portal_type, + resource_value=product, + quantity=quantity, + ) + self.assertEqual(price, sale_order_line.getPrice()) + self.assertEqual( + total_price, + round(sale_order_line.getTotalPrice(), currency.getQuantityPrecision()) + ) + + for case in [ + {'quantity': 9, 'price': 10., 'total_price': 90.}, + {'quantity': 11, 'price': 9.90909, 'total_price': 109.}, + {'quantity': 15, 'price': 9.66667, 'total_price': 145.}, + {'quantity': 19, 'price': 9.52632, 'total_price': 181.}, + {'quantity': 25, 'price': 9.2, 'total_price': 230.}, + ]: + _test(**case) def testQuantityPrecision(self): """test how to define quantity precision on resources. diff --git a/product/ERP5Type/tests/testFunctionalCore.py b/product/ERP5Type/tests/testFunctionalCore.py index 0ab7664a31b6e41a1ce55d245c444c4826679a96..d620fe19be2260152b6e99483bd0bdb2207b2fc3 100644 --- a/product/ERP5Type/tests/testFunctionalCore.py +++ b/product/ERP5Type/tests/testFunctionalCore.py @@ -56,8 +56,6 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase): 'erp5_configurator_standard_invoicing_template', 'erp5_simulation_test', 'erp5_accounting_ui_test', - 'erp5_pdm_ui_test', - 'erp5_trade_ui_test', 'erp5_project_ui_test', 'erp5_ingestion_mysql_innodb_catalog', 'erp5_ingestion', 'erp5_web', 'erp5_dms', 'erp5_dms_ui_test',