Commit c02d985f authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Group movements by Subscription Request when generating the invoice

Added a new movement group
Delivery Builder was reconfigured to perform accordinally
parent c6c8ff1e
......@@ -2,41 +2,76 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Delivery Causality Assignment Movement Group" module="erp5.portal_type"/>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/delivery</string>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>delivery_causality_assignment_movement_group_on_delivery</string> </value>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>4</int> </value>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Delivery Causality Assignment Movement Group</string> </value>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/MovementGroup_view</string> </value>
</item>
</dictionary>
</pickle>
......
##############################################################################
#
# Copyright (c) 2020 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5.Document.MovementGroup import MovementGroup
class RootAppliedRuleCausalityCausalityMovementGroup(MovementGroup):
"""
The purpose of MovementGroup is to define how movements are grouped,
and how values are updated from simulation movements.
This movement group is used to group movements whose root apply rule
has the same causality of the causality.
"""
meta_type = 'ERP5 Root Applied Rule Causality Causality Movement Group'
portal_type = 'Root Applied Rule Causality Causality Movement Group'
def _getPropertyDict(self, movement, **kw):
property_dict = {}
root_causality_causality_value = self._getRootCausalityCausalityValue(movement)
property_dict['root_causality_causality_value_list'] = [root_causality_causality_value]
return property_dict
def test(self, movement, property_dict, **kw):
# We can always update
return True, property_dict
def _getRootCausalityCausalityValue(self, movement):
""" Get the causality value of the causality of the root applied rule for a movement """
root_causality = movement.getRootAppliedRule().getCausalityValue()
if root_causality is not None:
return root_causality.getCausalityValue()
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>RootAppliedRuleCausalityCausalityMovementGroup</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.RootAppliedRuleCausalityCausalityMovementGroup</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
<none/>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Causality Movement Group" module="erp5.portal_type"/>
<global name="Root Applied Rule Causality Causality Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -22,7 +22,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>causality_movement_group_on_delivery</string> </value>
<value> <string>root_applied_rule_causality_causality_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
......@@ -30,13 +30,11 @@
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Causality Movement Group</string> </value>
<value> <string>Root Applied Rule Causality Causality Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
<value> <string>root_applied_rule_causality_causality_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -6,6 +6,9 @@
<item>Computer Consumption TioXML File</item>
<item>User Consumption HTML File</item>
</portal_type>
<portal_type id="Delivery Builder">
<item>Root Applied Rule Causality Causality Movement Group</item>
</portal_type>
<portal_type id="Order Tool">
<item>SlapOS Accounting Quantity Updating Order Builder</item>
</portal_type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>content_icon</string> </key>
<value> <string>document_icon.gif</string> </value>
</item>
<item>
<key> <string>content_meta_type</string> </key>
<value> <string>ERP5 Root Applied Rule Causality Movement Group</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string> The purpose of MovementGroup is to define how movements are grouped,\n
and how values are updated from simulation movements.\n
</string> </value>
</item>
<item>
<key> <string>factory</string> </key>
<value> <string>addRootAppliedRuleCausalityMovementGroup</string> </value>
</item>
<item>
<key> <string>filter_content_types</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<tuple>
<string>movement_group</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Root Applied Rule Causality Causality Movement Group</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>RootAppliedRuleCausalityCausalityMovementGroup</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -8,6 +8,7 @@ Hosting Subscription | jump_to_related_open_order_line
Hosting Subscription | periodicity
Payment Transaction | related_payzen_event
Person | jump_to_cloud_contract
Root Applied Rule Causality Causality Movement Group | view
Sale Invoice Transaction | create_slapos_reversal
SlapOS Accounting Quantity Updating Order Builder | view
SlapOS Accounting Quantity Updating Order Builder | view_predicate_group
......
document.erp5.SlapOSAccountingQuantityUpdatingOrderBuilder
document.erp5.SubscriptionItemRootSimulationRule
document.erp5.RootAppliedRuleCausalityCausalityMovementGroup
\ No newline at end of file
Cloud Contract Module | Cloud Contract
Consumption Document Module | Computer Consumption TioXML File
Consumption Document Module | User Consumption HTML File
Delivery Builder | Root Applied Rule Causality Causality Movement Group
Order Tool | SlapOS Accounting Quantity Updating Order Builder
Rule Tool | Subscription Item Root Simulation Rule
SlapOS Accounting Quantity Updating Order Builder | Base Variant Movement Group
......
......@@ -2,6 +2,7 @@ Cloud Contract
Cloud Contract Module
Computer Consumption TioXML File
Consumption Document Module
Root Applied Rule Causality Causality Movement Group
SlapOS Accounting Quantity Updating Order Builder
Subscription Item Root Simulation Rule
User Consumption HTML File
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment