Commit cc98d08e authored by Julien Muchembled's avatar Julien Muchembled

Fix testRule

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40112 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f95d845e
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</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>return context.generatePredicate(criterion_property_list=("start_date",))\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>_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>RuleMixin_asPredicate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
144 145
\ No newline at end of file \ No newline at end of file
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
class DeliveryRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class DeliveryRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
""" """
Delivery Rule object make sure an Delivery in the simulation Delivery Rule object make sure an Delivery in the simulation
is consistent with the real delivery is consistent with the real delivery
......
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
class DeliverySimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class DeliverySimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
""" """
Delivery Rule object make sure an Delivery in the simulation Delivery Rule object make sure an Delivery in the simulation
is consistent with the real delivery is consistent with the real delivery
......
...@@ -31,12 +31,11 @@ ...@@ -31,12 +31,11 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
class InvoiceRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class InvoiceRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
""" """
""" """
# CMF Type Definition # CMF Type Definition
......
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
class InvoiceSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class InvoiceSimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
""" """
Invoicing Rule expand simulation created by a order or delivery rule. Invoicing Rule expand simulation created by a order or delivery rule.
""" """
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
...@@ -37,7 +36,7 @@ from Products.ERP5.Document.PredicateMatrix import PredicateMatrix ...@@ -37,7 +36,7 @@ from Products.ERP5.Document.PredicateMatrix import PredicateMatrix
class InvoiceTransactionSimulationRule(RuleMixin, class InvoiceTransactionSimulationRule(RuleMixin,
MovementCollectionUpdaterMixin, Predicate, PredicateMatrix): MovementCollectionUpdaterMixin, PredicateMatrix):
""" """
Invoice Transaction Rule object generates accounting movements for Invoice Transaction Rule object generates accounting movements for
each invoice movement based on category membership and other each invoice movement based on category membership and other
......
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
class OrderRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class OrderRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
""" """
Order Rule object make sure an Order in the simulation Order Rule object make sure an Order in the simulation
is consistent with the real order is consistent with the real order
......
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
class PaymentSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class PaymentSimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
""" """
Payment Rule generates payment simulation movement from invoice Payment Rule generates payment simulation movement from invoice
transaction simulation movements. transaction simulation movements.
......
...@@ -30,12 +30,11 @@ import zope.interface ...@@ -30,12 +30,11 @@ import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin from Products.ERP5.mixin.rule import RuleMixin, MovementGeneratorMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
class TradeModelSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class TradeModelSimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
""" """
Rule for Trade Model Rule for Trade Model
""" """
......
...@@ -142,7 +142,7 @@ class MovementGeneratorMixin: ...@@ -142,7 +142,7 @@ class MovementGeneratorMixin:
# and potentially use trade phase for that.... as a way to filter out # and potentially use trade phase for that.... as a way to filter out
class RuleMixin: class RuleMixin(Predicate):
""" """
Provides generic methods and helper methods to implement Provides generic methods and helper methods to implement
IRule and IMovementCollectionUpdater. IRule and IMovementCollectionUpdater.
...@@ -186,19 +186,18 @@ class RuleMixin: ...@@ -186,19 +186,18 @@ class RuleMixin:
activate_kw=activate_kw) activate_kw=activate_kw)
return context.get(id) return context.get(id)
def test(self, *args, **kw): if 0: # XXX-JPS - if people are stupid enough not to configfure predicates,
"""
If no test method is defined, return False, to prevent infinite loop
XXX-JPS - I do not understand why
"""
#if not self.getTestMethodId():
# return False # XXX-JPS - if people are stupid enough not to configfure predicates,
# it is not our role to be clever for them # it is not our role to be clever for them
# Rules have a workflow - make sure applicable rule system works # Rules have a workflow - make sure applicable rule system works
# if you wish, add a test here on workflow state to prevent using # if you wish, add a test here on workflow state to prevent using
# rules which are no longer applicable # rules which are no longer applicable
return Predicate.test(self, *args, **kw) def test(self, *args, **kw):
"""
If no test method is defined, return False, to prevent infinite loop
"""
if not self.getTestMethodId():
return False
return super(RuleMixin, self).test(*args, **kw)
def expand(self, applied_rule, **kw): def expand(self, applied_rule, **kw):
""" """
......
This diff is collapsed.
...@@ -57,6 +57,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): ...@@ -57,6 +57,7 @@ class TestOrderMixin(SubcontentReindexingWrapper):
packing_list_cell_portal_type = 'Sale Packing List Cell' packing_list_cell_portal_type = 'Sale Packing List Cell'
delivery_builder_id = 'sale_packing_list_builder' delivery_builder_id = 'sale_packing_list_builder'
size_list = ['Baby','Child/32','Child/34','Man','Woman'] size_list = ['Baby','Child/32','Child/34','Man','Woman']
business_process = None
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """
......
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