Commit 367fdee8 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

rename simulation rules according to the new naming convention.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33255 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3cb9cc4b
No related merge requests found
...@@ -38,7 +38,7 @@ from Products.ERP5.mixin.movement_collection_updater import \ ...@@ -38,7 +38,7 @@ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class DeliveryRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class DeliveryRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
""" """
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
...@@ -46,8 +46,8 @@ class DeliveryRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): ...@@ -46,8 +46,8 @@ class DeliveryRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
WARNING: what to do with movement split ? WARNING: what to do with movement split ?
""" """
# CMF Type Definition # CMF Type Definition
meta_type = 'ERP5 Delivery Rule' meta_type = 'ERP5 Delivery Root Simulation Rule'
portal_type = 'Delivery Rule' portal_type = 'Delivery Root Simulation Rule'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
##############################################################################
#
# Copyright (c) 2010 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.
#
##############################################################################
"""
XXX This file is experimental for new simulation implementation, and
will replace DeliveryRule.
"""
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5.Document.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin
from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class DeliverySimulationRule(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 Simulation Rule'
portal_type = 'Delivery Simulation Rule'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative interfaces
zope.interface.implements(interfaces.IRule,
interfaces.IDivergenceController,
interfaces.IMovementCollectionUpdater,)
# Default Properties
property_sheets = (
PropertySheet.Base,
PropertySheet.XMLObject,
PropertySheet.CategoryCore,
PropertySheet.DublinCore,
PropertySheet.Task,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.Version,
PropertySheet.Rule
)
def _getMovementGenerator(self):
"""
Return the movement generator to use in the expand process
"""
return DeliveryRuleMovementGenerator()
def _getMovementGeneratorContext(self, context):
"""
Return the movement generator context to use for expand
"""
return context
def _getMovementGeneratorMovementList(self):
"""
Return the movement lists to provide to the movement generator
"""
return []
def _isProfitAndLossMovement(self, movement):
# For a kind of trade rule, a profit and loss movement lacks source
# or destination.
return (movement.getSource() is None or movement.getDestination() is None)
class DeliveryRuleMovementGenerator(MovementGeneratorMixin):
def getGeneratedMovementList(self, context, movement_list=None,
rounding=False):
"""
Input movement list comes from the parent
"""
ret = []
for input_movement, business_path in self \
._getInputMovementAndPathTupleList(context):
kw = self._getPropertyAndCategoryList(input_movement, business_path)
kw.update({'order':None,'delivery':None})
simulation_movement = context.newContent(
portal_type=RuleMixin.movement_type,
temp_object=True,
**kw)
ret.append(simulation_movement)
return ret
...@@ -38,14 +38,14 @@ from Products.ERP5.mixin.movement_collection_updater import \ ...@@ -38,14 +38,14 @@ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class InvoiceRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class InvoiceRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
""" """
InvoiceRule and DeliveryRule seems to be identical. Keep it for InvoiceRule and DeliveryRule seems to be identical. Keep it for
compatibility only. compatibility only.
""" """
# CMF Type Definition # CMF Type Definition
meta_type = 'ERP5 Invoice Rule' meta_type = 'ERP5 Invoice Root Simulation Rule'
portal_type = 'Invoice Rule' portal_type = 'Invoice Root Simulation Rule'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -38,13 +38,13 @@ from Products.ERP5.mixin.movement_collection_updater import \ ...@@ -38,13 +38,13 @@ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class InvoicingRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class InvoiceSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
""" """
Invoicing Rule expand simulation created by a order or delivery rule. Invoicing Rule expand simulation created by a order or delivery rule.
""" """
# CMF Type Definition # CMF Type Definition
meta_type = 'ERP5 Invoicing Rule' meta_type = 'ERP5 Invoice Simulation Rule'
portal_type = 'Invoicing Rule' portal_type = 'Invoice Simulation Rule'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -39,7 +39,7 @@ from Products.ERP5.mixin.movement_collection_updater import \ ...@@ -39,7 +39,7 @@ from Products.ERP5.mixin.movement_collection_updater import \
from Products.ERP5.Document.PredicateMatrix import PredicateMatrix from Products.ERP5.Document.PredicateMatrix import PredicateMatrix
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate, PredicateMatrix): class InvoiceTransactionSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate, 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
...@@ -47,8 +47,8 @@ class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicat ...@@ -47,8 +47,8 @@ class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicat
an instance of the InvoiceTransactionRule. an instance of the InvoiceTransactionRule.
""" """
# CMF Type Definition # CMF Type Definition
meta_type = 'ERP5 Invoice Transaction Rule' meta_type = 'ERP5 Invoice Transaction Simulation Rule'
portal_type = 'Invoice Transaction Rule' portal_type = 'Invoice Transaction Simulation Rule'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -38,7 +38,7 @@ from Products.ERP5.mixin.movement_collection_updater import \ ...@@ -38,7 +38,7 @@ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class OrderRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class OrderRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
""" """
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
...@@ -46,8 +46,8 @@ class OrderRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): ...@@ -46,8 +46,8 @@ class OrderRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
WARNING: what to do with movement split ? WARNING: what to do with movement split ?
""" """
# CMF Type Definition # CMF Type Definition
meta_type = 'ERP5 Order Rule' meta_type = 'ERP5 Order Root Simulation Rule'
portal_type = 'Order Rule' portal_type = 'Order Root Simulation Rule'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -38,14 +38,14 @@ from Products.ERP5.mixin.movement_collection_updater import \ ...@@ -38,14 +38,14 @@ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class PaymentRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class PaymentSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
""" """
Payment Rule generates payment simulation movement from invoice Payment Rule generates payment simulation movement from invoice
transaction simulation movements. transaction simulation movements.
""" """
# CMF Type Definition # CMF Type Definition
meta_type = 'ERP5 Payment Rule' meta_type = 'ERP5 Payment Simulation Rule'
portal_type = 'Payment Rule' portal_type = 'Payment Simulation Rule'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
...@@ -38,13 +38,13 @@ from Products.ERP5.mixin.movement_collection_updater import \ ...@@ -38,13 +38,13 @@ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class TradeModelRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class TradeModelSimulationRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
""" """
Rule for Trade Model Rule for Trade Model
""" """
# CMF Type Definition # CMF Type Definition
meta_type = 'ERP5 Trade Model Rule' meta_type = 'ERP5 Trade Model Simulation Rule'
portal_type = 'Trade Model Rule' portal_type = 'Trade Model Simulation Rule'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
47 48
\ No newline at end of file \ No newline at end of file
DeliveryRule DeliveryRootSimulationRule
InvoiceRule DeliverySimulationRule
InvoiceTransactionRule InvoiceRootSimulationRule
InvoicingRule InvoiceSimulationRule
OrderRule InvoiceTransactionSimulationRule
PaymentRule OrderRootSimulationRule
TradeModelRule PaymentSimulationRule
\ No newline at end of file TradeModelSimulationRule
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