diff --git a/bt5/erp5_simulation/DocumentTemplateItem/DeliveryRule.py b/bt5/erp5_simulation/DocumentTemplateItem/DeliveryRule.py index bf50508a965e4be902918e105e39a34f211c878d..de8cf4f02b65653658c8b13d6e402efac5333c58 100644 --- a/bt5/erp5_simulation/DocumentTemplateItem/DeliveryRule.py +++ b/bt5/erp5_simulation/DocumentTemplateItem/DeliveryRule.py @@ -37,11 +37,18 @@ from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.movement_collection_updater import \ MovementCollectionUpdaterMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin -from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList -# XXX this class should be moved to Rule.py once new simulation is fully -# integrated. -class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): +class DeliveryRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): + """ + Delivery Rule object make sure an Delivery in the simulation + is consistent with the real delivery + + WARNING: what to do with movement split ? + """ + # CMF Type Definition + meta_type = 'ERP5 Delivery Rule' + portal_type = 'Delivery Rule' + # Declarative security security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) @@ -64,38 +71,6 @@ class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): PropertySheet.Rule ) - security.declareProtected(Permissions.View, 'getDivergenceList') - def getDivergenceList(self, movement): - """ - Returns a list of divergences of the movements provided - in delivery_or_movement. - - movement -- a movement, a delivery, a simulation movement, - or a list thereof - """ - if movement.getDelivery() is None: - return [] - result_list = [] - for divergence_tester in self._getDivergenceTesterList( - exclude_quantity=False): - result = divergence_tester.explain(movement) - if isinstance(result, (list, tuple)): # for compatibility - result_list.extend(result) - elif result is not None: - result_list.append(result) - return result_list - -class DeliveryRule(Rule): - """ - Delivery Rule object make sure an Delivery in the simulation - is consistent with the real delivery - - WARNING: what to do with movement split ? - """ - # CMF Type Definition - meta_type = 'ERP5 Delivery Rule' - portal_type = 'Delivery Rule' - def _getMovementGenerator(self): """ Return the movement generator to use in the expand process diff --git a/bt5/erp5_simulation/DocumentTemplateItem/InvoiceTransactionRule.py b/bt5/erp5_simulation/DocumentTemplateItem/InvoiceTransactionRule.py index 703d90f5671c3ca595553f7a45a0d2b29096eea4..ba0dfbbc176f59c2ac6b59fd29bea7c0fc13017f 100644 --- a/bt5/erp5_simulation/DocumentTemplateItem/InvoiceTransactionRule.py +++ b/bt5/erp5_simulation/DocumentTemplateItem/InvoiceTransactionRule.py @@ -39,9 +39,17 @@ from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList from Products.ERP5.Document.PredicateMatrix import PredicateMatrix -# XXX this class should be moved to Rule.py once new simulation is fully -# integrated. -class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): +class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate, PredicateMatrix): + """ + Invoice Transaction Rule object generates accounting movements for + each invoice movement based on category membership and other + predicated. Template accounting movements are stored in cells inside + an instance of the InvoiceTransactionRule. + """ + # CMF Type Definition + meta_type = 'ERP5 Invoice Transaction Rule' + portal_type = 'Invoice Transaction Rule' + # Declarative security security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) @@ -64,38 +72,6 @@ class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): PropertySheet.Rule ) - security.declareProtected(Permissions.View, 'getDivergenceList') - def getDivergenceList(self, movement): - """ - Returns a list of divergences of the movements provided - in delivery_or_movement. - - movement -- a movement, a delivery, a simulation movement, - or a list thereof - """ - if movement.getDelivery() is None: - return [] - result_list = [] - for divergence_tester in self._getDivergenceTesterList( - exclude_quantity=False): - result = divergence_tester.explain(movement) - if isinstance(result, (list, tuple)): # for compatibility - result_list.extend(result) - elif result is not None: - result_list.append(result) - return result_list - -class InvoiceTransactionRule(Rule, PredicateMatrix): - """ - Invoice Transaction Rule object generates accounting movements for - each invoice movement based on category membership and other - predicated. Template accounting movements are stored in cells inside - an instance of the InvoiceTransactionRule. - """ - # CMF Type Definition - meta_type = 'ERP5 Invoice Transaction Rule' - portal_type = 'Invoice Transaction Rule' - def _getMovementGenerator(self): """ Return the movement generator to use in the expand process diff --git a/bt5/erp5_simulation/DocumentTemplateItem/InvoicingRule.py b/bt5/erp5_simulation/DocumentTemplateItem/InvoicingRule.py index 1e0eefec39b1945d40ecde584277ceb40a4e3194..109940f19018e49fe7b7ce687759d5779238e8b4 100644 --- a/bt5/erp5_simulation/DocumentTemplateItem/InvoicingRule.py +++ b/bt5/erp5_simulation/DocumentTemplateItem/InvoicingRule.py @@ -37,11 +37,15 @@ from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.movement_collection_updater import \ MovementCollectionUpdaterMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin -from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList -# XXX this class should be moved to Rule.py once new simulation is fully -# integrated. -class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): +class InvoicingRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): + """ + Invoicing Rule expand simulation created by a order or delivery rule. + """ + # CMF Type Definition + meta_type = 'ERP5 Invoicing Rule' + portal_type = 'Invoicing Rule' + # Declarative security security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) @@ -64,35 +68,6 @@ class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): PropertySheet.Rule ) - security.declareProtected(Permissions.View, 'getDivergenceList') - def getDivergenceList(self, movement): - """ - Returns a list of divergences of the movements provided - in delivery_or_movement. - - movement -- a movement, a delivery, a simulation movement, - or a list thereof - """ - if movement.getDelivery() is None: - return [] - result_list = [] - for divergence_tester in self._getDivergenceTesterList( - exclude_quantity=False): - result = divergence_tester.explain(movement) - if isinstance(result, (list, tuple)): # for compatibility - result_list.extend(result) - elif result is not None: - result_list.append(result) - return result_list - -class InvoicingRule(Rule): - """ - Invoicing Rule expand simulation created by a order or delivery rule. - """ - # CMF Type Definition - meta_type = 'ERP5 Invoicing Rule' - portal_type = 'Invoicing Rule' - def _getMovementGenerator(self): """ Return the movement generator to use in the expand process diff --git a/bt5/erp5_simulation/DocumentTemplateItem/OrderRule.py b/bt5/erp5_simulation/DocumentTemplateItem/OrderRule.py index 8fce9af5b8548b5401716d119d239e25a4ef56aa..87796a11f335e128f00eba7d9c5b60251609f57c 100644 --- a/bt5/erp5_simulation/DocumentTemplateItem/OrderRule.py +++ b/bt5/erp5_simulation/DocumentTemplateItem/OrderRule.py @@ -37,11 +37,18 @@ from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.movement_collection_updater import \ MovementCollectionUpdaterMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin -from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList -# XXX this class should be moved to Rule.py once new simulation is fully -# integrated. -class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): +class OrderRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): + """ + Order Rule object make sure an Order in the simulation + is consistent with the real order + + WARNING: what to do with movement split ? + """ + # CMF Type Definition + meta_type = 'ERP5 Order Rule' + portal_type = 'Order Rule' + # Declarative security security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) @@ -64,38 +71,6 @@ class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): PropertySheet.Rule ) - security.declareProtected(Permissions.View, 'getDivergenceList') - def getDivergenceList(self, movement): - """ - Returns a list of divergences of the movements provided - in delivery_or_movement. - - movement -- a movement, a delivery, a simulation movement, - or a list thereof - """ - if movement.getDelivery() is None: - return [] - result_list = [] - for divergence_tester in self._getDivergenceTesterList( - exclude_quantity=False): - result = divergence_tester.explain(movement) - if isinstance(result, (list, tuple)): # for compatibility - result_list.extend(result) - elif result is not None: - result_list.append(result) - return result_list - -class OrderRule(Rule): - """ - Order Rule object make sure an Order in the simulation - is consistent with the real order - - WARNING: what to do with movement split ? - """ - # CMF Type Definition - meta_type = 'ERP5 Order Rule' - portal_type = 'Order Rule' - def _getMovementGenerator(self): """ Return the movement generator to use in the expand process diff --git a/bt5/erp5_simulation/DocumentTemplateItem/PaymentRule.py b/bt5/erp5_simulation/DocumentTemplateItem/PaymentRule.py index 895cb3a8223dc597a7fd1ca68e559cf0afb8bfb4..5ec1f3029db43cc0b7b4704873eaf27fe8a217d7 100644 --- a/bt5/erp5_simulation/DocumentTemplateItem/PaymentRule.py +++ b/bt5/erp5_simulation/DocumentTemplateItem/PaymentRule.py @@ -37,11 +37,16 @@ from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.movement_collection_updater import \ MovementCollectionUpdaterMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin -from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList -# XXX this class should be moved to Rule.py once new simulation is fully -# integrated. -class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): +class PaymentRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): + """ + Payment Rule generates payment simulation movement from invoice + transaction simulation movements. + """ + # CMF Type Definition + meta_type = 'ERP5 Payment Rule' + portal_type = 'Payment Rule' + # Declarative security security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) @@ -64,36 +69,6 @@ class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): PropertySheet.Rule ) - security.declareProtected(Permissions.View, 'getDivergenceList') - def getDivergenceList(self, movement): - """ - Returns a list of divergences of the movements provided - in delivery_or_movement. - - movement -- a movement, a delivery, a simulation movement, - or a list thereof - """ - if movement.getDelivery() is None: - return [] - result_list = [] - for divergence_tester in self._getDivergenceTesterList( - exclude_quantity=False): - result = divergence_tester.explain(movement) - if isinstance(result, (list, tuple)): # for compatibility - result_list.extend(result) - elif result is not None: - result_list.append(result) - return result_list - -class PaymentRule(Rule): - """ - Payment Rule generates payment simulation movement from invoice - transaction simulation movements. - """ - # CMF Type Definition - meta_type = 'ERP5 Payment Rule' - portal_type = 'Payment Rule' - def _getMovementGenerator(self): """ Return the movement generator to use in the expand process diff --git a/bt5/erp5_simulation/DocumentTemplateItem/TradeModelRule.py b/bt5/erp5_simulation/DocumentTemplateItem/TradeModelRule.py index 630b4ce18020434cd1433191710f80efe7a7df05..4e15aeb3b216162aebafbf94327cbcc6ba43ecf8 100644 --- a/bt5/erp5_simulation/DocumentTemplateItem/TradeModelRule.py +++ b/bt5/erp5_simulation/DocumentTemplateItem/TradeModelRule.py @@ -37,11 +37,15 @@ from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.movement_collection_updater import \ MovementCollectionUpdaterMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin -from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList -# XXX this class should be moved to Rule.py once new simulation is fully -# integrated. -class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): +class TradeModelRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): + """ + Rule for Trade Model + """ + # CMF Type Definition + meta_type = 'ERP5 Trade Model Rule' + portal_type = 'Trade Model Rule' + # Declarative security security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) @@ -64,35 +68,6 @@ class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): PropertySheet.Rule ) - security.declareProtected(Permissions.View, 'getDivergenceList') - def getDivergenceList(self, movement): - """ - Returns a list of divergences of the movements provided - in delivery_or_movement. - - movement -- a movement, a delivery, a simulation movement, - or a list thereof - """ - if movement.getDelivery() is None: - return [] - result_list = [] - for divergence_tester in self._getDivergenceTesterList( - exclude_quantity=False): - result = divergence_tester.explain(movement) - if isinstance(result, (list, tuple)): # for compatibility - result_list.extend(result) - elif result is not None: - result_list.append(result) - return result_list - -class TradeModelRule(Rule): - """ - Rule for Trade Model - """ - # CMF Type Definition - meta_type = 'ERP5 Trade Model Rule' - portal_type = 'Trade Model Rule' - def _getMovementGenerator(self): """ Return the movement generator to use in the expand process