diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_asPredicate.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_asPredicate.xml index 916a814e70ee4795be73713a4cb1e003dc5c2155..477e694b8a4f2d5852ae341464ed32febb3f97c1 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_asPredicate.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_asPredicate.xml @@ -57,6 +57,9 @@ # ideally strict membership should be an option for each category, but this API\n # does not exist in predicates.\n \n +# TODO: support virtual "All other nodes"\n +\n +\n return context.generatePredicate(\n multimembership_criterion_base_category_list = (\'resource\',),\n criterion_property_list = (\'start_date\', \'stop_date\'))\n diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getConsumedBudget.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getConsumedBudget.xml index f990512978b1e8f7bae4695e518d51f7ff3d7cb7..518d4099296c3af8e27ebaec5c2039c828feaf63 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getConsumedBudget.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getConsumedBudget.xml @@ -66,7 +66,9 @@ if at_date:\n kw.setdefault(\'at_date\', at_date)\n \n # XXX use getBudgetConsumptionMethod ?\n -return context.portal_simulation.getCurrentInventoryAssetPrice(src__=src__, **kw)\n +if src__:\n + return context.portal_simulation.getCurrentInventoryAssetPrice(src__=src__, **kw)\n +return (context.portal_simulation.getCurrentInventoryAssetPrice(**kw) or 0) * context.getParentValue().BudgetLine_getConsumptionSign()\n </string> </value> </item> <item> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getEngagedBudget.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getEngagedBudget.xml index aa5b5dca0ffb45b612d16d9be4de82b957cc8dca..6fe021b53dac3d9c507581840f9b124ebbdf9642 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getEngagedBudget.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetCell_getEngagedBudget.xml @@ -70,7 +70,9 @@ kw.setdefault(\'explanation_simulation_state\', context.getPortalReservedInvento + context.getPortalTransitInventoryStateList())\n \n # XXX use getBudgetConsumptionMethod ?\n -return context.portal_simulation.getInventoryAssetPrice(src__=src__, **kw)\n +if src__:\n + return context.portal_simulation.getInventoryAssetPrice(src__=src__, **kw)\n +return (context.portal_simulation.getInventoryAssetPrice(**kw) or 0) * context.getParentValue().BudgetLine_getConsumptionSign()\n </string> </value> </item> <item> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_getConsumptionSign.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_getConsumptionSign.xml new file mode 100644 index 0000000000000000000000000000000000000000..efecadfbd7806abcedb8a714bf9a5e4faf001611 --- /dev/null +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_getConsumptionSign.xml @@ -0,0 +1,132 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>editable_property_list = zip(*context.BudgetLine_getEditablePropertyList())[0]\n +\n +if \'destination_credit\' in editable_property_list:\n + return -1\n +if \'destination_asset_credit\' in editable_property_list:\n + return -1\n +return 1\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>_getitem_</string> + <string>_apply_</string> + <string>zip</string> + <string>_getattr_</string> + <string>context</string> + <string>editable_property_list</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>BudgetLine_getConsumptionSign</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_getEditablePropertyList.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_getEditablePropertyList.xml new file mode 100644 index 0000000000000000000000000000000000000000..46c627df85f192ad9bc54fd951a265d837e277b1 --- /dev/null +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_getEditablePropertyList.xml @@ -0,0 +1,141 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>item_list = []\n +\n +# FIXME: it\'s not so good to use a category here ...\n +\n +if context.isMemberOf(\'budget_line_type/quantity\'):\n + item_list.append((\'quantity\', \'quantity\'))\n +if context.isMemberOf(\'budget_line_type/destination_debit\'):\n + item_list.append((\'destination_debit\', \'destination_debit\'))\n +if context.isMemberOf(\'budget_line_type/destination_credit\'):\n + item_list.append((\'destination_credit\', \'destination_credit\'))\n +\n +if not item_list:\n + # by default we use quantity\n + item_list = [(\'quantity\', \'quantity\')]\n +\n +item_list.append(\n + (\'membership_criterion_category_list\',\n + \'membership_criterion_category_list\'))\n +return item_list\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>item_list</string> + <string>_getattr_</string> + <string>context</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>BudgetLine_getEditablePropertyList</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view.xml index d5fcacc1fb2a653f7c883534696c253b33f2e96c..362cf48a811a9f94a835c54b397723362ebeb8dc 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view.xml @@ -88,6 +88,8 @@ <list> <string>matrixbox_membership_criterion_category_list</string> <string>matrixbox_quantity</string> + <string>matrixbox_destination_credit</string> + <string>matrixbox_destination_debit</string> </list> </value> </item> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_destination_credit.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_destination_credit.xml new file mode 100644 index 0000000000000000000000000000000000000000..d0ec0333fc45b6f386f0ab69b64c29af256b1c32 --- /dev/null +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_destination_credit.xml @@ -0,0 +1,148 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>default</string> + <string>enabled</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>matrixbox_destination_credit</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>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</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>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>field_id</string> </key> + <value> <string>matrixbox_quantity</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>BudgetLine_viewFieldLibrary</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> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>cell/getDestinationCredit | nothing</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: \'destination_credit\' in zip(*context.BudgetLine_getEditablePropertyList())[0]</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_destination_debit.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_destination_debit.xml new file mode 100644 index 0000000000000000000000000000000000000000..4311d73861d2d0e57537b9ae7fd412bb034461d3 --- /dev/null +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_destination_debit.xml @@ -0,0 +1,148 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>default</string> + <string>enabled</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>matrixbox_destination_debit</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>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</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>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>field_id</string> </key> + <value> <string>matrixbox_quantity</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>BudgetLine_viewFieldLibrary</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> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>cell/getDestinationDebit | nothing</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: \'destination_debit\' in zip(*context.BudgetLine_getEditablePropertyList())[0]</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_membership_criterion_category_list.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_membership_criterion_category_list.xml index f695c43af77d4db60ebaac475af75488f7be8402..3b3f2ef39bf006ca0f52fa1af1e53faa140df9b3 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_membership_criterion_category_list.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_membership_criterion_category_list.xml @@ -115,7 +115,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: list(cell_index) + context.getMembershipCriterionCategoryList() + [context.getResource(base=1),] # XXX make this in a script ? or interaction workflow ?</string> </value> + <value> <string>python: list(cell_index) + context.getMembershipCriterionCategoryList() + context.getParentValue().getMembershipCriterionCategoryList() + [context.getResource(base=1),] # XXX make this in a script ? or interaction workflow ?</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_quantity.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_quantity.xml index 1926da9c2b7d13bb6ca7dafd831be17340a92e8f..185e3cb78f8cd592a2d2fefddc4d13fc763a0405 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_quantity.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/matrixbox_quantity.xml @@ -12,7 +12,9 @@ <item> <key> <string>delegated_list</string> </key> <value> - <list/> + <list> + <string>enabled</string> + </list> </value> </item> <item> @@ -53,6 +55,12 @@ <key> <string>tales</string> </key> <value> <dictionary> + <item> + <key> <string>enabled</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string></string> </value> @@ -72,6 +80,10 @@ <key> <string>values</string> </key> <value> <dictionary> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string>matrixbox_quantity</string> </value> @@ -90,4 +102,20 @@ </dictionary> </pickle> </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: \'quantity\' in zip(*context.BudgetLine_getEditablePropertyList())[0]</string> </value> + </item> + </dictionary> + </pickle> + </record> </ZopeData> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/your_total_initial_budget.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/your_total_initial_budget.xml index 5c8d6cf03d277fa57734d06e5c119e13c79a3261..8fa668455617ea338883d5fd7699774311690925 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/your_total_initial_budget.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_view/your_total_initial_budget.xml @@ -13,10 +13,10 @@ <key> <string>delegated_list</string> </key> <value> <list> - <string>title</string> <string>default</string> - <string>precision</string> <string>editable</string> + <string>precision</string> + <string>title</string> </list> </value> </item> @@ -64,6 +64,10 @@ <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string></string> </value> @@ -138,7 +142,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: sum([cell.getQuantity() for cell in context.getCellValueList()])</string> </value> + <value> <string>python: sum([cell.getQuantity() for cell in context.getCellValueList()]) * context.BudgetLine_getConsumptionSign()</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/matrixbox_quantity.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/matrixbox_quantity.xml index 646d2d4c6c2d0d8e47f892d982533f5c8d5debf4..cceccf48c4cfb5b76ace719875601db1ed2e1f9f 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/matrixbox_quantity.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/matrixbox_quantity.xml @@ -122,7 +122,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>cell/getCurrentBalance</string> </value> + <value> <string>python: cell.getCurrentBalance() * context.BudgetLine_getConsumptionSign()</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/your_total_current_budget.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/your_total_current_budget.xml index 3b2ceb6f60730f26b240ee1fd6bb76933c81ea0d..ba1e192fe9ad16d95e42d45f3c8dff810d847d7d 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/your_total_current_budget.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewCurrentBudget/your_total_current_budget.xml @@ -13,10 +13,10 @@ <key> <string>delegated_list</string> </key> <value> <list> - <string>title</string> <string>default</string> - <string>precision</string> <string>editable</string> + <string>precision</string> + <string>title</string> </list> </value> </item> @@ -142,7 +142,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: sum([cell.getCurrentBalance() for cell in context.getCellValueList()])</string> </value> + <value> <string>python: sum([cell.getCurrentBalance() for cell in context.getCellValueList()]) * context.BudgetLine_getConsumptionSign()</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/mapped_value_property_list.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/mapped_value_property_list.xml index a589af11e0e79bd0840b9274cfef0ef592119e72..d507dadb87df5da0ee2f0828502834fcb343a617 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/mapped_value_property_list.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/mapped_value_property_list.xml @@ -223,6 +223,11 @@ <value> <list> <string>quantity</string> + <string>price</string> + <string>destination_debit</string> + <string>destination_credit</string> + <string>destination_asset_debit</string> + <string>destination_asset_credit</string> </list> </value> </item> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/matrixbox.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/matrixbox.xml index d1163146e0e9a3f2f2344d5ab27faed85a602483..e5942e7548baf75548a5c620f73daf6dd1247922 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/matrixbox.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/matrixbox.xml @@ -111,19 +111,25 @@ <key> <string>alternate_name</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>as_cell_range_script_id</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>cell_base_id</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>cell_getter_method</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>cell_portal_type</string> </key> <value> <string></string> </value> </item> <item> <key> <string>columns</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> + <value> <string></string> </value> </item> <item> <key> <string>css_class</string> </key> @@ -143,7 +149,9 @@ </item> <item> <key> <string>editable_attributes</string> </key> - <value> <string></string> </value> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> </item> <item> <key> <string>enabled</string> </key> @@ -167,15 +175,11 @@ </item> <item> <key> <string>lines</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> - </value> + <value> <string></string> </value> </item> <item> <key> <string>tabs</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> - </value> + <value> <string></string> </value> </item> <item> <key> <string>title</string> </key> @@ -196,10 +200,18 @@ <key> <string>alternate_name</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>as_cell_range_script_id</string> </key> + <value> <string>BudgetLine_asCellRange</string> </value> + </item> <item> <key> <string>cell_base_id</string> </key> <value> <string>cell</string> </value> </item> + <item> + <key> <string>cell_getter_method</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>cell_portal_type</string> </key> <value> <string>Budget Cell</string> </value> @@ -301,56 +313,15 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> - </tuple> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_text</string> </key> - <value> <string>python: here.BudgetLine_asCellRange(matrixbox=1)[1]</string> </value> - </item> - </dictionary> - </pickle> - </record> - <record id="3" aka="AAAAAAAAAAM="> - <pickle> - <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> - </tuple> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_text</string> </key> - <value> <string>python: here.BudgetLine_asCellRange(matrixbox=1)[0]</string> </value> - </item> - </dictionary> - </pickle> - </record> - <record id="4" aka="AAAAAAAAAAQ="> - <pickle> - <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.BudgetLine_asCellRange(matrixbox=1)[2]</string> </value> + <value> <string>context/BudgetLine_getEditablePropertyList</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/membership_criterion_base_category_list.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/membership_criterion_base_category_list.xml index 179bc17f03aa501e9cb3c20d47f16395bb11d617..e3116044d83dbbb33943a6045e423446ec054fca 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/membership_criterion_base_category_list.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/BudgetLine_viewFieldLibrary/membership_criterion_base_category_list.xml @@ -303,18 +303,15 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>here/getVariationBaseCategoryList</string> </value> + <value> <string>python: context.getVariationBaseCategoryList() + context.getParentValue().getVariationBaseCategoryList() # XXX add resource ??</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_getBudgetConsumptionReportData.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_getBudgetConsumptionReportData.xml index eb1478109f540293d4b091f156aa81ebe2da7d46..f63f2b301e2d5d9d0d4d488dd721cd3b43762654 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_getBudgetConsumptionReportData.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_getBudgetConsumptionReportData.xml @@ -150,14 +150,15 @@ for budget in budget_list:\n title=cell_name_dict[level_2_category])]\n \n for level_3_category in level_3_variation_category_list:\n + sign = budget_line.BudgetLine_getConsumptionSign()\n for cell in budget_line.getCellValueList():\n if not isVisibleCell(cell):\n continue\n if level_2_category in cell.getMembershipCriterionCategoryList() and\\\n level_3_category in cell.getMembershipCriterionCategoryList():\n \n - initial_budget = cell.getQuantity()\n - current_budget = cell.getCurrentBalance()\n + initial_budget = cell.getQuantity() * sign\n + current_budget = cell.getCurrentBalance() * sign\n engaged_budget = cell.getEngagedBudget()\n consumed_budget = cell.getConsumedBudget()\n available_budget = cell.getAvailableBudget()\n @@ -316,6 +317,7 @@ return pformat(line_list)\n <string>total_level_2_available_budget</string> <string>level_2_line_list</string> <string>level_3_category</string> + <string>sign</string> <string>cell</string> <string>initial_budget</string> <string>current_budget</string> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_viewBudgetConsumptionReport.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_viewBudgetConsumptionReport.xml index c094e461913d6e000a368957247141b38df17626..5f805476c139fadf319b3a09777d6a7c69deeb4a 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_viewBudgetConsumptionReport.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_viewBudgetConsumptionReport.xml @@ -475,7 +475,7 @@ AQABAEMAAAB9AQAAAAA=</string> </value> </item> <item> <key> <string>title</string> </key> - <value> <string></string> </value> + <value> <string>Budget Consumption</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/NodeBudgetVariation_view.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/NodeBudgetVariation_view.xml index 8c46b32a025fbb6da274414acc0e9218821d7a48..f13b90cac14744877e39134cebe9ff652eb63908 100644 --- a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/NodeBudgetVariation_view.xml +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/NodeBudgetVariation_view.xml @@ -112,6 +112,7 @@ <value> <list> <string>my_aggregate_title_list</string> + <string>my_include_virtual_other_node</string> </list> </value> </item> diff --git a/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/NodeBudgetVariation_view/my_include_virtual_other_node.xml b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/NodeBudgetVariation_view/my_include_virtual_other_node.xml new file mode 100644 index 0000000000000000000000000000000000000000..25455070407b8dfe591d70e79b69e21c406fbf23 --- /dev/null +++ b/bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/NodeBudgetVariation_view/my_include_virtual_other_node.xml @@ -0,0 +1,171 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="CheckBoxField" module="Products.Formulator.StandardFields"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_include_virtual_other_node</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>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Include a Virtual Node For "All Others"</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow.xml b/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow.xml index a5d8357c0975e84654d941b0267c7a4bc99007f5..01bf62d900f783ae74302b20af2d83ba3af89bcc 100644 --- a/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow.xml +++ b/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow.xml @@ -15,6 +15,17 @@ <tuple/> </value> </item> + <item> + <key> <string>creation_guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>TODO:\r\n + changing a membership must be "recursive" (or budget line/cell membership method should dynamically read from their parent)</string> </value> + </item> <item> <key> <string>groups</string> </key> <value> @@ -25,6 +36,14 @@ <key> <string>id</string> </key> <value> <string>budget_interaction_workflow</string> </value> </item> + <item> + <key> <string>manager_bypass</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Interaction Workflow Definition</string> </value> + </item> </dictionary> </pickle> </record> diff --git a/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow/interactions/setVariationCategoryList.xml b/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow/interactions/setVariationCategoryList.xml new file mode 100644 index 0000000000000000000000000000000000000000..a9cea31d8bae22de539929323f82f55e6dab4fb7 --- /dev/null +++ b/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow/interactions/setVariationCategoryList.xml @@ -0,0 +1,93 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <list> + <string>setMembershipCriterionCategoryListFromVariationCategory</string> + </list> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Sets the membership critertion categories from the variation categories.</string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>setVariationCategoryList</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>_setVariationCategoryList</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow/scripts/setMembershipCriterionCategoryListFromVariationCategory.xml b/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow/scripts/setMembershipCriterionCategoryListFromVariationCategory.xml new file mode 100644 index 0000000000000000000000000000000000000000..e0d1402412f8e23a70f8e28c23b45aaffd71121b --- /dev/null +++ b/bt5/erp5_budget/WorkflowTemplateItem/portal_workflow/budget_interaction_workflow/scripts/setMembershipCriterionCategoryListFromVariationCategory.xml @@ -0,0 +1,143 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>budget = sci[\'object\']\n +\n +membership_criterion_category_list = budget.getMembershipCriterionCategoryList()\n +for base_category in budget.getMembershipCriterionBaseCategoryList():\n + if base_category in budget.getVariationBaseCategoryList():\n + # Remove all previous membership from the same base\n + cleaned_membership_criterion_category_list = []\n + for membership_criterion_category in membership_criterion_category_list:\n + if not membership_criterion_category.startswith("%s/" % base_category):\n + cleaned_membership_criterion_category_list.append(membership_criterion_category)\n + # Add the new one\n + membership_criterion_category_list.extend(\n + budget.getVariationCategoryList(base_category_list=base_category))\n +\n +budget.setMembershipCriterionCategoryList(membership_criterion_category_list)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>sci</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>sci</string> + <string>_getitem_</string> + <string>budget</string> + <string>_getattr_</string> + <string>membership_criterion_category_list</string> + <string>_getiter_</string> + <string>base_category</string> + <string>cleaned_membership_criterion_category_list</string> + <string>membership_criterion_category</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>setMembershipCriterionCategoryListFromVariationCategory</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_budget/bt/revision b/bt5/erp5_budget/bt/revision index 7371afb09c216542b49bc443a3a57567c87116fb..b6e27607fb529c10ffeb626c858f55206242edb7 100644 --- a/bt5/erp5_budget/bt/revision +++ b/bt5/erp5_budget/bt/revision @@ -1 +1 @@ -236 \ No newline at end of file +242 \ No newline at end of file diff --git a/product/ERP5/Document/BudgetCell.py b/product/ERP5/Document/BudgetCell.py index bc1f2e5ea5515b74be2ee882ee874db4089ce9be..7162ee64a4b591e26d75f5fc5d079557b9d1b2d6 100644 --- a/product/ERP5/Document/BudgetCell.py +++ b/product/ERP5/Document/BudgetCell.py @@ -32,9 +32,11 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces from Products.ERP5.Document.Predicate import Predicate from Products.ERP5.Document.MetaNode import MetaNode +from Products.ERP5.Document.Movement import Movement -class BudgetCell(Predicate, MetaNode): +class BudgetCell(Predicate, MetaNode, Movement): """ Budget Cell defines a cell of budget. + XXX This is not a Movement, but we need getDestinationCredit """ # Default Properties diff --git a/product/ERP5/Document/CategoryBudgetVariation.py b/product/ERP5/Document/CategoryBudgetVariation.py index 58446e05efd7eaa7be6dd8edfb2c6391ff84755c..087cb6498e70b8d4daf2eb1e6f5feaaf4d8aee70 100644 --- a/product/ERP5/Document/CategoryBudgetVariation.py +++ b/product/ERP5/Document/CategoryBudgetVariation.py @@ -168,12 +168,19 @@ class CategoryBudgetVariation(BudgetVariation): def initializeBudget(self, budget): """Initialize a budget. """ - budget_variation_category_list =\ + budget_variation_base_category_list =\ list(budget.getVariationBaseCategoryList() or []) + budget_membership_criterion_base_category_list =\ + list(budget.getMembershipCriterionBaseCategoryList() or []) base_category = self.getProperty('variation_base_category') if base_category: - budget_variation_category_list.append(base_category) + if base_category not in budget_variation_base_category_list: + budget_variation_base_category_list.append(base_category) + if base_category not in budget_membership_criterion_base_category_list: + budget_membership_criterion_base_category_list.append(base_category) budget.setVariationBaseCategoryList( - budget_variation_category_list) + budget_variation_base_category_list) + budget.setMembershipCriterionBaseCategoryList( + budget_membership_criterion_base_category_list) diff --git a/product/ERP5/Document/NodeBudgetVariation.py b/product/ERP5/Document/NodeBudgetVariation.py index 800b8d1b979563f35300aa4c1e9260236876b5b9..817e8c160cbe7479e8ca524d977ad0309a4f5a0f 100644 --- a/product/ERP5/Document/NodeBudgetVariation.py +++ b/product/ERP5/Document/NodeBudgetVariation.py @@ -30,13 +30,38 @@ from AccessControl import ClassSecurityInfo from AccessControl.ZopeGuards import guarded_getattr from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces from Products.ERP5.Document.BudgetVariation import BudgetVariation +from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery +from Products.ERP5Type.Message import translateString + + +class VirtualNode(object): + """A Virtual Node for all Other Nodes. + + This virtual document can be used in budget variations. + """ + __allow_access_to_unprotected_subobjects__ = True + def __init__(self, relative_url): + """The Virtual Node will use the relative URL of the budget line for + memberships. + """ + self.relative_url = relative_url + + def getTitle(self): + return translateString('All Others') + + def getRelativeUrl(self): + return self.relative_url + + def getUid(self): + return -1L class NodeBudgetVariation(BudgetVariation): """ A budget variation for node A script will return the list of possible nodes, or they will be configured - explicitly on the budget variation. + explicitly on the budget variation. It is also possible to include a virtual + node for all others not selected nodes. """ # Default Properties property_sheets = ( PropertySheet.Base @@ -72,6 +97,9 @@ class NodeBudgetVariation(BudgetVariation): if node_select_method_id: return guarded_getattr(context, node_select_method_id)() # no script defined, used the explicitly selected values + if self.getProperty('include_virtual_other_node'): + return self.getAggregateValueList() + [ + VirtualNode(context.getRelativeUrl()), ] return self.getAggregateValueList() def _getNodeTitle(self, node): @@ -105,6 +133,7 @@ class NodeBudgetVariation(BudgetVariation): base_category = self.getProperty('variation_base_category') if not base_category: return dict() + budget_line = budget_cell.getParentValue() for criterion_category in budget_cell.getMembershipCriterionCategoryList(): if '/' not in criterion_category: # safe ... continue @@ -113,6 +142,14 @@ class NodeBudgetVariation(BudgetVariation): if axis == 'movement': axis = 'default_%s' % base_category axis = '%s_uid' % axis + if node_url == budget_line.getRelativeUrl(): + # This is the "All Other" virtual node + other_uid_list = [] + for node in self._getNodeList(budget_line): + if '%s/%s' % (base_category, node.getRelativeUrl()) in\ + budget_line.getVariationCategoryList(): + other_uid_list.append(node.getUid()) + return {axis: NegatedQuery(Query(**{axis: other_uid_list}))} return {axis: self.getPortalObject().unrestrictedTraverse(node_url).getUid()} @@ -161,12 +198,18 @@ class NodeBudgetVariation(BudgetVariation): def initializeBudget(self, budget): """Initialize a budget. """ - budget_variation_category_list =\ + budget_variation_base_category_list =\ list(budget.getVariationBaseCategoryList() or []) + budget_membership_criterion_base_category_list =\ + list(budget.getMembershipCriterionBaseCategoryList() or []) base_category = self.getProperty('variation_base_category') if base_category: - budget_variation_category_list.append(base_category) + if base_category not in budget_variation_base_category_list: + budget_variation_base_category_list.append(base_category) + if base_category not in budget_membership_criterion_base_category_list: + budget_membership_criterion_base_category_list.append(base_category) budget.setVariationBaseCategoryList( - budget_variation_category_list) - + budget_variation_base_category_list) + budget.setMembershipCriterionBaseCategoryList( + budget_membership_criterion_base_category_list)