Commit 2b76f25e authored by Yoshinori Okuji's avatar Yoshinori Okuji

Use portal methods instead of global variables.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1836 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 184792eb
...@@ -32,7 +32,6 @@ from AccessControl import ClassSecurityInfo ...@@ -32,7 +32,6 @@ from AccessControl import ClassSecurityInfo
from Products.CMFCore.WorkflowCore import WorkflowAction from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.DeliveryLine import DeliveryLine from Products.ERP5.Document.DeliveryLine import DeliveryLine
from Products.ERP5.ERP5Globals import balance_transaction_line_type_list
from Products.ERP5.Document.Amount import Amount from Products.ERP5.Document.Amount import Amount
from zLOG import LOG from zLOG import LOG
...@@ -202,7 +201,7 @@ Une ligne tarifaire.""" ...@@ -202,7 +201,7 @@ Une ligne tarifaire."""
security.declarePrivate('_setSource') security.declarePrivate('_setSource')
def _setSource(self, value): def _setSource(self, value):
self._setCategoryMembership('source', value, base=0) self._setCategoryMembership('source', value, base=0)
if self.getPortalType() not in balance_transaction_line_type_list: if self.getPortalType() not in self.getPortalBalanceTransactionLineTypeList():
source = self.restrictedTraverse(value) source = self.restrictedTraverse(value)
destination = self.getDestination() destination = self.getDestination()
mirror_list = source.getDestinationList() mirror_list = source.getDestinationList()
...@@ -220,7 +219,7 @@ Une ligne tarifaire.""" ...@@ -220,7 +219,7 @@ Une ligne tarifaire."""
security.declarePrivate('_setDestination') security.declarePrivate('_setDestination')
def _setDestination(self, value): def _setDestination(self, value):
if self.getPortalType() not in balance_transaction_line_type_list: if self.getPortalType() not in self.getPortalBalanceTransactionLineTypeList():
self._setCategoryMembership('destination', value, base=0) self._setCategoryMembership('destination', value, base=0)
destination = self.restrictedTraverse(value) destination = self.restrictedTraverse(value)
source = self.getSource() source = self.getSource()
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Rule import Rule from Products.ERP5.Document.Rule import Rule
from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list, reserved_inventory_state_list, current_inventory_state_list, draft_order_state
from DateTime import DateTime from DateTime import DateTime
from copy import deepcopy from copy import deepcopy
from string import lower from string import lower
...@@ -120,7 +119,7 @@ An ERP5 Rule...""" ...@@ -120,7 +119,7 @@ An ERP5 Rule..."""
# An order rule never applies since it is always explicitely instanciated # An order rule never applies since it is always explicitely instanciated
# XXX And if it is an amortisation rule ? # XXX And if it is an amortisation rule ?
return 0 return 0
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
...@@ -134,18 +133,18 @@ An ERP5 Rule...""" ...@@ -134,18 +133,18 @@ An ERP5 Rule..."""
is expanded. is expanded.
""" """
delivery_line_type = 'Simulation Movement' delivery_line_type = 'Simulation Movement'
# Get the item we come from # Get the item we come from
my_item = applied_rule.getDefaultCausalityValue() my_item = applied_rule.getDefaultCausalityValue()
# Only expand if my_item is not None # Only expand if my_item is not None
if my_item is not None: if my_item is not None:
### First, plan the theorical accounting movements ### First, plan the theorical accounting movements
accounting_movement_list = [] accounting_movement_list = []
immobilisation_movement_list = my_item.getImmobilisationMovementValueList() immobilisation_movement_list = my_item.getImmobilisationMovementValueList()
current_immo_movement = None current_immo_movement = None
for mvt_number in range(len(immobilisation_movement_list)): for mvt_number in range(len(immobilisation_movement_list)):
# Get processed immobilisation movements # Get processed immobilisation movements
...@@ -155,15 +154,15 @@ An ERP5 Rule...""" ...@@ -155,15 +154,15 @@ An ERP5 Rule..."""
next_immo_movement = immobilisation_movement_list[mvt_number + 1] next_immo_movement = immobilisation_movement_list[mvt_number + 1]
else: else:
next_immo_movement = None next_immo_movement = None
# Calculate the accounting movements # Calculate the accounting movements
accounting_movements = self._getAccountingMovement(current_immo_movement=current_immo_movement, accounting_movements = self._getAccountingMovement(current_immo_movement=current_immo_movement,
next_immo_movement=next_immo_movement, next_immo_movement=next_immo_movement,
previous_immo_movement=prev_immo_movement) previous_immo_movement=prev_immo_movement)
accounting_movement_list.extend(accounting_movements) accounting_movement_list.extend(accounting_movements)
### The next step is to create the simulation movements ### The next step is to create the simulation movements
# First, we delete all of the simulation movements which are children # First, we delete all of the simulation movements which are children
# of the applied rule : the entire simulation for this item has been # of the applied rule : the entire simulation for this item has been
...@@ -181,8 +180,8 @@ An ERP5 Rule...""" ...@@ -181,8 +180,8 @@ An ERP5 Rule..."""
else: else:
if movement_last_id_list.get( movement_id_name, None) is None or movement_id_number > movement_last_id_list[movement_id_name]: if movement_last_id_list.get( movement_id_name, None) is None or movement_id_number > movement_last_id_list[movement_id_name]:
movement_last_id_list[movement_id_name] = movement_id_number movement_last_id_list[movement_id_name] = movement_id_number
applied_rule.deleteContent(movement_id_list) applied_rule.deleteContent(movement_id_list)
ids = {} ids = {}
for accounting_movement in accounting_movement_list: for accounting_movement in accounting_movement_list:
...@@ -192,17 +191,17 @@ An ERP5 Rule...""" ...@@ -192,17 +191,17 @@ An ERP5 Rule..."""
ids[my_type] = movement_last_id_list.get(my_type, None) ids[my_type] = movement_last_id_list.get(my_type, None)
if ids[my_type] is None: if ids[my_type] is None:
ids[my_type] = -1 ids[my_type] = -1
ids[my_type] = ids[my_type] + 1 ids[my_type] = ids[my_type] + 1
new_id = my_type + '_' + str(ids[my_type]) new_id = my_type + '_' + str(ids[my_type])
# Round date # Round date
stop_date = accounting_movement['stop_date'] stop_date = accounting_movement['stop_date']
if stop_date.latestTime() - stop_date < 1/24.: if stop_date.latestTime() - stop_date < 1/24.:
stop_date = stop_date + 1 stop_date = stop_date + 1
stop_date = DateTime('%s/%s/%s' % (repr(stop_date.year()), repr(stop_date.month()), repr(stop_date.day()))) stop_date = DateTime('%s/%s/%s' % (repr(stop_date.year()), repr(stop_date.month()), repr(stop_date.day())))
accounting_movement['stop_date'] = stop_date accounting_movement['stop_date'] = stop_date
simulation_movement = applied_rule.newContent(portal_type=delivery_line_type, id=new_id ) simulation_movement = applied_rule.newContent(portal_type=delivery_line_type, id=new_id )
simulation_movement.setStartDate(stop_date) simulation_movement.setStartDate(stop_date)
simulation_movement.setTargetStartDate(stop_date) simulation_movement.setTargetStartDate(stop_date)
...@@ -215,35 +214,35 @@ An ERP5 Rule...""" ...@@ -215,35 +214,35 @@ An ERP5 Rule..."""
setter_name += tokens[i].capitalize() setter_name += tokens[i].capitalize()
setter = getattr(simulation_movement, setter_name) setter = getattr(simulation_movement, setter_name)
setter(value) setter(value)
security.declareProtected(Permissions.View, '_getAccountingMovement') security.declareProtected(Permissions.View, '_getAccountingMovement')
def _getAccountingMovement(self,current_immo_movement,next_immo_movement=None, previous_immo_movement=None): def _getAccountingMovement(self,current_immo_movement,next_immo_movement=None, previous_immo_movement=None):
""" """
Calculates the value of accounting movements during the period Calculates the value of accounting movements during the period
between the two given immobilisation movements. between the two given immobilisation movements.
If next_immo_movement is None, accounting movements are made at infinite. If next_immo_movement is None, accounting movements are made at infinite.
""" """
item = current_immo_movement.getParent() item = current_immo_movement.getParent()
if item is not None: if item is not None:
# First we need to calculate the item value at the first immobilisation movement date # First we need to calculate the item value at the first immobilisation movement date
begin_value = current_immo_movement.getAmortisationOrDefaultAmortisationPrice() begin_value = current_immo_movement.getAmortisationOrDefaultAmortisationPrice()
begin_remaining = current_immo_movement.getAmortisationOrDefaultAmortisationDuration() begin_remaining = current_immo_movement.getAmortisationOrDefaultAmortisationDuration()
# To find financial end date, we need to know the company # To find financial end date, we need to know the company
section = current_immo_movement.getSectionValue() section = current_immo_movement.getSectionValue()
currency = current_immo_movement.getPriceCurrency() currency = current_immo_movement.getPriceCurrency()
if currency is not None: if currency is not None:
currency = self.currency[currency.split('/')[-1]] currency = self.currency[currency.split('/')[-1]]
start_date = current_immo_movement.getStopDate() start_date = current_immo_movement.getStopDate()
if next_immo_movement is not None: if next_immo_movement is not None:
stop_date = next_immo_movement.getStopDate() stop_date = next_immo_movement.getStopDate()
else: else:
stop_date = None stop_date = None
returned_list = [] returned_list = []
# Calculate particular accounting movements (immobilisation beginning, end, ownership change...) # Calculate particular accounting movements (immobilisation beginning, end, ownership change...)
LOG('_getAccountingMovement start_date',0,start_date) LOG('_getAccountingMovement start_date',0,start_date)
...@@ -251,7 +250,7 @@ An ERP5 Rule...""" ...@@ -251,7 +250,7 @@ An ERP5 Rule..."""
immobilised_before = item.isImmobilised(at_date = start_date - centis) immobilised_before = item.isImmobilised(at_date = start_date - centis)
immobilised_after = current_immo_movement.getImmobilisation() immobilised_after = current_immo_movement.getImmobilisation()
replace = 0 replace = 0
if immobilised_before and previous_immo_movement is not None: if immobilised_before and previous_immo_movement is not None:
immo_begin_value = previous_immo_movement.getAmortisationOrDefaultAmortisationPrice() immo_begin_value = previous_immo_movement.getAmortisationOrDefaultAmortisationPrice()
immo_end_value = current_immo_movement.getDefaultAmortisationPrice() # We use this method in order to get the calculated value immo_end_value = current_immo_movement.getDefaultAmortisationPrice() # We use this method in order to get the calculated value
...@@ -293,8 +292,8 @@ An ERP5 Rule...""" ...@@ -293,8 +292,8 @@ An ERP5 Rule..."""
'destination_section_value' : previous_immo_movement.getSectionValue(), 'destination_section_value' : previous_immo_movement.getSectionValue(),
'resource_value' : currency } ] ) 'resource_value' : currency } ] )
replace = 1 replace = 1
if immobilised_after: if immobilised_after:
immo_begin_value = begin_value immo_begin_value = begin_value
begin_vat = current_immo_movement.getVat() begin_vat = current_immo_movement.getVat()
...@@ -340,8 +339,8 @@ An ERP5 Rule...""" ...@@ -340,8 +339,8 @@ An ERP5 Rule..."""
'source_section_value' : section, 'source_section_value' : section,
'destination_section_value' : None, 'destination_section_value' : None,
'resource_value' : currency } ] ) 'resource_value' : currency } ] )
if replace: if replace:
# Replace destination by source on the immobilisation-ending writings # Replace destination by source on the immobilisation-ending writings
for i in range(4): for i in range(4):
...@@ -350,15 +349,15 @@ An ERP5 Rule...""" ...@@ -350,15 +349,15 @@ An ERP5 Rule..."""
returned_list[i]['destination'] = None returned_list[i]['destination'] = None
returned_list[i]['destination_section_value'] = None returned_list[i]['destination_section_value'] = None
returned_list[i]['quantity'] = - returned_list[i]['quantity'] returned_list[i]['quantity'] = - returned_list[i]['quantity']
# Calculate the annuities # Calculate the annuities
current_value = begin_value current_value = begin_value
if immobilised_after: if immobilised_after:
# Search for the first financial end date after the first immobilisation movement # Search for the first financial end date after the first immobilisation movement
end_date = getClosestDate(target_date=start_date, date=section.getFinancialYearStopDate(), precision='year', before=0) end_date = getClosestDate(target_date=start_date, date=section.getFinancialYearStopDate(), precision='year', before=0)
while (stop_date is None and current_value > 0) or (stop_date is not None and end_date - stop_date < 0): while (stop_date is None and current_value > 0) or (stop_date is not None and end_date - stop_date < 0):
annuity_end_value = item.getAmortisationPrice(at_date=end_date) annuity_end_value = item.getAmortisationPrice(at_date=end_date)
if annuity_end_value is not None: if annuity_end_value is not None:
...@@ -380,10 +379,10 @@ An ERP5 Rule...""" ...@@ -380,10 +379,10 @@ An ERP5 Rule..."""
'source_section_value' : section, 'source_section_value' : section,
'destination_section_value': None, 'destination_section_value': None,
'resource_value' : currency } ] ) 'resource_value' : currency } ] )
current_value -= annuity_value current_value -= annuity_value
end_date = addToDate(end_date, {'year':1}) end_date = addToDate(end_date, {'year':1})
# Get the last period until the next immobilisation movement # Get the last period until the next immobilisation movement
if stop_date is not None: if stop_date is not None:
# We use getDefaultAmortisationPrice in order to get the calculated value of the item, # We use getDefaultAmortisationPrice in order to get the calculated value of the item,
...@@ -408,11 +407,11 @@ An ERP5 Rule...""" ...@@ -408,11 +407,11 @@ An ERP5 Rule..."""
'source_section_value' : section, 'source_section_value' : section,
'destination_section_value': None, 'destination_section_value': None,
'resource_value' : currency } ] ) 'resource_value' : currency } ] )
return returned_list return returned_list
security.declareProtected(Permissions.ModifyPortalContent, 'solve') security.declareProtected(Permissions.ModifyPortalContent, 'solve')
def solve(self, applied_rule, solution_list): def solve(self, applied_rule, solution_list):
""" """
...@@ -462,6 +461,6 @@ An ERP5 Rule...""" ...@@ -462,6 +461,6 @@ An ERP5 Rule..."""
def isDeliverable(self, m): def isDeliverable(self, m):
return 1 return 1
# XXX ? # XXX ?
if m.getSimulationState() in draft_order_state: if m.getSimulationState() in self.getPortalDraftOrderStateList():
return 0 return 0
return 1 return 1
...@@ -38,8 +38,7 @@ from Products.ERP5Type.Base import TempBase ...@@ -38,8 +38,7 @@ from Products.ERP5Type.Base import TempBase
from Products.ERP5.Document.Amount import Amount from Products.ERP5.Document.Amount import Amount
from Products.ERP5.ERP5Globals import resource_type_list, variation_type_list, \ from Products.CMFCore.Expression import Expression
column_base_category_list, line_base_category_list, tab_base_category_list
from zLOG import LOG from zLOG import LOG
...@@ -141,7 +140,7 @@ class AssortedResource(TransformedResource): ...@@ -141,7 +140,7 @@ class AssortedResource(TransformedResource):
'description' : "", 'description' : "",
'type' : 'tokens', 'type' : 'tokens',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -252,14 +251,14 @@ identify a bank account.""" ...@@ -252,14 +251,14 @@ identify a bank account."""
column = None column = None
line = None line = None
sorted_list = [None, None] sorted_list = [None, None]
for category in column_base_category_list: for category in self.getPortalColumnBaseCategoryList():
if category in base_category_list: if category in base_category_list:
if column is None: if column is None:
column = category column = category
else: else:
sorted_list.append(category) sorted_list.append(category)
base_category_list.remove(category) base_category_list.remove(category)
for category in line_base_category_list: for category in self.getPortalLineBaseCategoryList():
if category in base_category_list: if category in base_category_list:
if line is None: if line is None:
line = category line = category
...@@ -640,7 +639,7 @@ identify a bank account.""" ...@@ -640,7 +639,7 @@ identify a bank account."""
variation_base_category_list, variation, base=1) variation_base_category_list, variation, base=1)
# and update the price with the variation price if necessary # and update the price with the variation price if necessary
for resource_variation in self.getValueList( for resource_variation in self.getValueList(
variation_base_category_list, portal_type=variation_type_list): variation_base_category_list, portal_type=self.getPortalVariationTypeList()):
if resource_variation.hasDefaultBasePrice(): if resource_variation.hasDefaultBasePrice():
new_base_price = resource_variation.getBasePrice() new_base_price = resource_variation.getBasePrice()
try: try:
...@@ -713,7 +712,7 @@ identify a bank account.""" ...@@ -713,7 +712,7 @@ identify a bank account."""
self.portal_categories.setCategoryMembership(line_item, base_category_list, self.portal_categories.setCategoryMembership(line_item, base_category_list,
mapped_value.getCategoryMembershipList(base_category_list, base=1), base=1) mapped_value.getCategoryMembershipList(base_category_list, base=1), base=1)
for resource_variation in mapped_value.getValueList(base_category_list, for resource_variation in mapped_value.getValueList(base_category_list,
portal_type=variation_type_list): portal_type=self.getPortalVariationTypeList()):
if resource_variation.hasDefaultBasePrice(): if resource_variation.hasDefaultBasePrice():
new_base_price = resource_variation.getBasePrice() new_base_price = resource_variation.getBasePrice()
try: try:
......
This diff is collapsed.
...@@ -34,7 +34,6 @@ from Products.CMFCore.WorkflowCore import WorkflowAction ...@@ -34,7 +34,6 @@ from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5.ERP5Globals import current_inventory_state_list, target_inventory_state_list
from Products.ERP5.Document.OrderLine import OrderLine from Products.ERP5.Document.OrderLine import OrderLine
from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.Movement import Movement
from Products.ERP5.Document.SetMappedValue import SetMappedValue from Products.ERP5.Document.SetMappedValue import SetMappedValue
...@@ -305,7 +304,7 @@ Une ligne tarifaire.""" ...@@ -305,7 +304,7 @@ Une ligne tarifaire."""
""" """
Take into account efficiency in converted target quantity Take into account efficiency in converted target quantity
""" """
if self.getSimulationState() in target_inventory_state_list: if self.getSimulationState() in self.getPortalTargetInventoryStateList():
# When an order is delivered, the target quantity should be considered # When an order is delivered, the target quantity should be considered
# rather than the quantity # rather than the quantity
return Movement.getNetConvertedTargetQuantity(self) return Movement.getNetConvertedTargetQuantity(self)
...@@ -317,7 +316,7 @@ Une ligne tarifaire.""" ...@@ -317,7 +316,7 @@ Une ligne tarifaire."""
""" """
Take into account efficiency in converted target quantity Take into account efficiency in converted target quantity
""" """
if self.getSimulationState() in current_inventory_state_list: if self.getSimulationState() in self.getPortalCurrentInventoryStateList():
# When an order is delivered, the target quantity should be considered # When an order is delivered, the target quantity should be considered
# rather than the quantity # rather than the quantity
return Movement.getTargetStartDate(self) return Movement.getTargetStartDate(self)
...@@ -329,7 +328,7 @@ Une ligne tarifaire.""" ...@@ -329,7 +328,7 @@ Une ligne tarifaire."""
""" """
Take into account efficiency in converted target quantity Take into account efficiency in converted target quantity
""" """
if self.getSimulationState() in current_inventory_state_list: if self.getSimulationState() in self.getPortalCurrentInventoryStateList():
# When an order is delivered, the target quantity should be considered # When an order is delivered, the target quantity should be considered
# rather than the quantity # rather than the quantity
return Movement.getTargetStopDate(self) return Movement.getTargetStopDate(self)
...@@ -389,7 +388,7 @@ Une ligne tarifaire.""" ...@@ -389,7 +388,7 @@ Une ligne tarifaire."""
def _edit(self, REQUEST=None, force_update = 0, reindex_object = 0, **kw): def _edit(self, REQUEST=None, force_update = 0, reindex_object = 0, **kw):
""" """
""" """
SetMappedValue._edit(self, REQUEST=REQUEST, force_update = force_update, SetMappedValue._edit(self, REQUEST=REQUEST, force_update = force_update,
reindex_object=reindex_object, **kw) reindex_object=reindex_object, **kw)
if self.isSimulated(): if self.isSimulated():
self.getRootDeliveryValue().activate().propagateResourceToSimulation() self.getRootDeliveryValue().activate().propagateResourceToSimulation()
...@@ -397,4 +396,4 @@ Une ligne tarifaire.""" ...@@ -397,4 +396,4 @@ Une ligne tarifaire."""
if kw.has_key('item_id_list'): if kw.has_key('item_id_list'):
self._setItemIdList( kw['item_id_list'] ) self._setItemIdList( kw['item_id_list'] )
...@@ -36,7 +36,6 @@ from Products.ERP5Type.XMLMatrix import XMLMatrix ...@@ -36,7 +36,6 @@ from Products.ERP5Type.XMLMatrix import XMLMatrix
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5.ERP5Globals import current_inventory_state_list, target_inventory_state_list
from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.Movement import Movement
from Products.ERP5.Variated import Variated from Products.ERP5.Variated import Variated
...@@ -378,7 +377,7 @@ Une ligne tarifaire.""" ...@@ -378,7 +377,7 @@ Une ligne tarifaire."""
Take into account efficiency in converted target quantity Take into account efficiency in converted target quantity
Maybe we should only use target if isDivergent Maybe we should only use target if isDivergent
""" """
if self.getSimulationState() in target_inventory_state_list: if self.getSimulationState() in self.getPortalTargetInventoryStateList():
# When an order is delivered, the target quantity should be considered # When an order is delivered, the target quantity should be considered
# rather than the quantity # rather than the quantity
return Movement.getNetConvertedTargetQuantity(self) return Movement.getNetConvertedTargetQuantity(self)
...@@ -390,7 +389,7 @@ Une ligne tarifaire.""" ...@@ -390,7 +389,7 @@ Une ligne tarifaire."""
""" """
Take into account efficiency in converted target quantity Take into account efficiency in converted target quantity
""" """
if self.getSimulationState() in current_inventory_state_list: if self.getSimulationState() in self.getPortalCurrentInventoryStateList():
# When an order is delivered, the target quantity should be considered # When an order is delivered, the target quantity should be considered
# rather than the quantity # rather than the quantity
return Movement.getTargetStartDate(self) return Movement.getTargetStartDate(self)
...@@ -402,7 +401,7 @@ Une ligne tarifaire.""" ...@@ -402,7 +401,7 @@ Une ligne tarifaire."""
""" """
Take into account efficiency in converted target quantity Take into account efficiency in converted target quantity
""" """
if self.getSimulationState() in current_inventory_state_list: if self.getSimulationState() in self.getPortalCurrentInventoryStateList():
# When an order is delivered, the target quantity should be considered # When an order is delivered, the target quantity should be considered
# rather than the quantity # rather than the quantity
return Movement.getTargetStopDate(self) return Movement.getTargetStopDate(self)
...@@ -546,4 +545,4 @@ Une ligne tarifaire.""" ...@@ -546,4 +545,4 @@ Une ligne tarifaire."""
Returns the root delivery responsible of this line Returns the root delivery responsible of this line
""" """
return self.getParent().getRootDeliveryValue() return self.getParent().getRootDeliveryValue()
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Rule import Rule from Products.ERP5.Document.Rule import Rule
from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list, draft_order_state
from zLOG import LOG from zLOG import LOG
...@@ -137,14 +136,14 @@ An ERP5 Rule...""" ...@@ -137,14 +136,14 @@ An ERP5 Rule..."""
# Only expand if my_delivery is not None and state is not 'confirmed' # Only expand if my_delivery is not None and state is not 'confirmed'
if my_delivery is not None: if my_delivery is not None:
#if my_delivery.getSimulationState() not in ('delivered', ): #if my_delivery.getSimulationState() not in ('delivered', ):
# Even if delivered, we should always calculate consequences # Even if delivered, we should always calculate consequences
if 1: if 1:
# First, check each contained movement and make # First, check each contained movement and make
# a list of delivery ids which do not need to be copied # a list of delivery ids which do not need to be copied
# eventually delete movement which do not exist anylonger # eventually delete movement which do not exist anylonger
existing_uid_list = [] existing_uid_list = []
for movement in applied_rule.contentValues(filter={'portal_type':movement_type_list}): for movement in applied_rule.contentValues(filter={'portal_type':applied_rule.getPortalMovementTypeList()}):
delivery_value = movement.getDeliveryValue(portal_type=order_movement_type_list) delivery_value = movement.getDeliveryValue(portal_type=applied_rule.getPortalOrderMovementTypeList())
if delivery_value is None: if delivery_value is None:
movement.flushActivity(invoke=0) movement.flushActivity(invoke=0)
applied_rule._delObject(movement.getId()) # XXXX Make sure this is not deleted if already in delivery applied_rule._delObject(movement.getId()) # XXXX Make sure this is not deleted if already in delivery
...@@ -171,7 +170,7 @@ An ERP5 Rule...""" ...@@ -171,7 +170,7 @@ An ERP5 Rule..."""
existing_uid_list += [delivery_value.getUid()] existing_uid_list += [delivery_value.getUid()]
# Copy each movement (line or cell) from the delivery is that # Copy each movement (line or cell) from the delivery is that
for delivery_line_object in my_delivery.contentValues(filter={'portal_type':movement_type_list}): for delivery_line_object in my_delivery.contentValues(filter={'portal_type':applied_rule.getPortalMovementTypeList()}):
try: try:
if delivery_line_object.hasCellContent(): if delivery_line_object.hasCellContent():
for c in delivery_line_object.getCellValueList(): for c in delivery_line_object.getCellValueList():
...@@ -267,6 +266,6 @@ An ERP5 Rule...""" ...@@ -267,6 +266,6 @@ An ERP5 Rule..."""
return 1 return 1
def isDeliverable(self, m): def isDeliverable(self, m):
if m.getSimulationState() in draft_order_state: if m.getSimulationState() in m.getPortalDraftOrderState():
return 0 return 0
return 1 return 1
...@@ -30,8 +30,6 @@ from Globals import InitializeClass, PersistentMapping ...@@ -30,8 +30,6 @@ from Globals import InitializeClass, PersistentMapping
from Acquisition import aq_base, aq_inner, aq_parent, aq_self from Acquisition import aq_base, aq_inner, aq_parent, aq_self
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5.ERP5Globals import current_inventory_state_list
from Products.CMFCore.WorkflowCore import WorkflowAction from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
...@@ -195,7 +193,7 @@ Une ligne tarifaire.""" ...@@ -195,7 +193,7 @@ Une ligne tarifaire."""
variation_text = self.getVariationText(), variation_text = self.getVariationText(),
node = self.getDestination(), node = self.getDestination(),
section_category = self.getDestinationSection(), # We want to consolidate section_category = self.getDestinationSection(), # We want to consolidate
simulation_state = current_inventory_state_list) simulation_state = self.getPortalCurrentInventoryStateList())
inventory = self.getInventory() inventory = self.getInventory()
if current_inventory in (None, ''): if current_inventory in (None, ''):
current_inventory = 0.0 current_inventory = 0.0
......
...@@ -30,8 +30,6 @@ from Globals import InitializeClass, PersistentMapping ...@@ -30,8 +30,6 @@ from Globals import InitializeClass, PersistentMapping
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base, aq_inner, aq_parent, aq_self from Acquisition import aq_base, aq_inner, aq_parent, aq_self
from Products.ERP5.ERP5Globals import current_inventory_state_list
from Products.CMFCore.WorkflowCore import WorkflowAction from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5Type.XMLMatrix import XMLMatrix
...@@ -183,7 +181,7 @@ Une ligne tarifaire.""" ...@@ -183,7 +181,7 @@ Une ligne tarifaire."""
variation_text = self.getVariationText(), variation_text = self.getVariationText(),
node = self.getDestination(), node = self.getDestination(),
section_category = self.getDestinationSection(), section_category = self.getDestinationSection(),
simulation_state = current_inventory_state_list) simulation_state = self.getPortalCurrentInventoryStateList())
inventory = self.getInventory() inventory = self.getInventory()
if current_inventory in (None, ''): if current_inventory in (None, ''):
current_inventory = 0.0 current_inventory = 0.0
......
This diff is collapsed.
...@@ -32,7 +32,6 @@ from Products.CMFCore.utils import getToolByName ...@@ -32,7 +32,6 @@ from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import WorkflowMethod from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5.ERP5Globals import movement_type_list, draft_order_state, planned_order_state
from Products.ERP5.Document.Delivery import Delivery from Products.ERP5.Document.Delivery import Delivery
...@@ -120,11 +119,11 @@ An order...""" ...@@ -120,11 +119,11 @@ An order..."""
def _edit(self, REQUEST=None, force_update = 0, **kw): def _edit(self, REQUEST=None, force_update = 0, **kw):
Delivery._edit(self, REQUEST=REQUEST, force_update = force_update, **kw) Delivery._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
# We must expand our applied rule only if not confirmed # We must expand our applied rule only if not confirmed
if self.getSimulationState() in planned_order_state: if self.getSimulationState() in self.getPortalPlannedOrderStateList():
self.updateAppliedRule() # This should be implemented with the interaction tool rather than with this hard coding self.updateAppliedRule() # This should be implemented with the interaction tool rather than with this hard coding
def updateAppliedRule(self): def updateAppliedRule(self):
if self.getSimulationState() not in draft_order_state: if self.getSimulationState() not in self.getPortalDraftOrderStateList():
# Nothing to do # Nothing to do
self._createOrderRule() self._createOrderRule()
...@@ -288,7 +287,7 @@ An order...""" ...@@ -288,7 +287,7 @@ An order..."""
portal_type = 'Simulation Movement'): portal_type = 'Simulation Movement'):
# And apply # And apply
getattr(my_simulation_movement, method_id)() getattr(my_simulation_movement, method_id)()
for m in self.contentValues(filter={'portal_type': movement_type_list}): for m in self.contentValues(filter={'portal_type': self.getPortalMovementTypeList()}):
# Find related in simulation # Find related in simulation
for my_simulation_movement in m.getOrderRelatedValueList( for my_simulation_movement in m.getOrderRelatedValueList(
portal_type = 'Simulation Movement'): portal_type = 'Simulation Movement'):
...@@ -311,7 +310,7 @@ An order...""" ...@@ -311,7 +310,7 @@ An order..."""
Returns simulation movements related to a cell or line of this order Returns simulation movements related to a cell or line of this order
""" """
result = self.getOrderRelatedValueList( portal_type = 'Simulation Movement') result = self.getOrderRelatedValueList( portal_type = 'Simulation Movement')
for m in self.contentValues(filter={'portal_type': movement_type_list}): for m in self.contentValues(filter={'portal_type': self.getPortalMovementTypeList()}):
# Find related in simulation # Find related in simulation
result += m.getOrderRelatedValueList( portal_type = 'Simulation Movement') result += m.getOrderRelatedValueList( portal_type = 'Simulation Movement')
for c in m.contentValues(filter={'portal_type': 'Delivery Cell'}): for c in m.contentValues(filter={'portal_type': 'Delivery Cell'}):
......
...@@ -33,7 +33,6 @@ from Products.CMFCore.WorkflowCore import WorkflowAction ...@@ -33,7 +33,6 @@ from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.DeliveryLine import DeliveryLine from Products.ERP5.Document.DeliveryLine import DeliveryLine
from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.Movement import Movement
from Products.ERP5.ERP5Globals import draft_order_state
from zLOG import LOG from zLOG import LOG
...@@ -167,7 +166,7 @@ Une ligne tarifaire.""" ...@@ -167,7 +166,7 @@ Une ligne tarifaire."""
self[k].flushActivity(invoke=0) self[k].flushActivity(invoke=0)
self[k].immediateReindexObject() # We are forced to do this is url is changed (not uid) self[k].immediateReindexObject() # We are forced to do this is url is changed (not uid)
self._delObject(k) self._delObject(k)
security.declarePrivate('_checkConsistency') security.declarePrivate('_checkConsistency')
def _checkConsistency(self, fixit=0, mapped_value_property_list = ('target_quantity', 'price')): def _checkConsistency(self, fixit=0, mapped_value_property_list = ('target_quantity', 'price')):
""" """
...@@ -207,7 +206,7 @@ Une ligne tarifaire.""" ...@@ -207,7 +206,7 @@ Une ligne tarifaire."""
(Called when the object is created or moved.) (Called when the object is created or moved.)
""" """
DeliveryLine.manage_afterAdd(self, item, container) DeliveryLine.manage_afterAdd(self, item, container)
if self.aq_parent.getSimulationState() not in draft_order_state: if self.aq_parent.getSimulationState() not in self.getPortalDraftOrderStateList():
# Only reexpand order rule when we add lines # Only reexpand order rule when we add lines
self.aq_parent.activate()._createOrderRule() self.aq_parent.activate()._createOrderRule()
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Rule import Rule from Products.ERP5.Document.Rule import Rule
from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list, reserved_inventory_state_list, current_inventory_state_list, draft_order_state
from zLOG import LOG from zLOG import LOG
...@@ -140,15 +139,15 @@ An ERP5 Rule...""" ...@@ -140,15 +139,15 @@ An ERP5 Rule..."""
# Only expand order rule if order not yet confirmed (This is consistent # Only expand order rule if order not yet confirmed (This is consistent
# with the fact that once simulation is launched, we stick to it) # with the fact that once simulation is launched, we stick to it)
if force or \ if force or \
(applied_rule.getLastExpandSimulationState() not in reserved_inventory_state_list and \ (applied_rule.getLastExpandSimulationState() not in applied_rule.getPortalReservedInventoryStateList() and \
applied_rule.getLastExpandSimulationState() not in current_inventory_state_list): applied_rule.getLastExpandSimulationState() not in applied_rule.getPortalCurrentInventoryStateList()):
# First, check each contained movement and make # First, check each contained movement and make
# a list of order ids which do not need to be copied # a list of order ids which do not need to be copied
# eventually delete movement which do not exist anylonger # eventually delete movement which do not exist anylonger
existing_uid_list = [] existing_uid_list = []
for movement in applied_rule.contentValues(filter={'portal_type':movement_type_list}): for movement in applied_rule.contentValues(filter={'portal_type':applied_rule.getPortalMovementTypeList()}):
#LOG('Movement', 0, str(movement)) #LOG('Movement', 0, str(movement))
order_value = movement.getOrderValue(portal_type=order_movement_type_list) order_value = movement.getOrderValue(portal_type=applied_rule.getPortalOrderMovementTypeList())
if order_value is None: if order_value is None:
movement.flushActivity(invoke=0) movement.flushActivity(invoke=0)
applied_rule._delObject(movement.getId()) # XXXX Make sur this is not deleted if already in delivery applied_rule._delObject(movement.getId()) # XXXX Make sur this is not deleted if already in delivery
...@@ -164,7 +163,7 @@ An ERP5 Rule...""" ...@@ -164,7 +163,7 @@ An ERP5 Rule..."""
existing_uid_list += [order_value.getUid()] existing_uid_list += [order_value.getUid()]
# Copy each movement (line or cell) from the order # Copy each movement (line or cell) from the order
for order_line_object in my_order.contentValues(filter={'portal_type':movement_type_list}): for order_line_object in my_order.contentValues(filter={'portal_type':applied_rule.getPortalMovementTypeList()}):
try: try:
if order_line_object.hasCellContent(): if order_line_object.hasCellContent():
for c in order_line_object.getCellValueList(): for c in order_line_object.getCellValueList():
...@@ -249,6 +248,6 @@ An ERP5 Rule...""" ...@@ -249,6 +248,6 @@ An ERP5 Rule..."""
return 1 return 1
def isDeliverable(self, m): def isDeliverable(self, m):
if m.getSimulationState() in draft_order_state: if m.getSimulationState() in m.getPortalDraftOrderState():
return 0 return 0
return 1 return 1
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
from Globals import InitializeClass, PersistentMapping from Globals import InitializeClass, PersistentMapping
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.ERP5Globals import movement_type_list, draft_order_state
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5.Document.Delivery import Delivery from Products.ERP5.Document.Delivery import Delivery
...@@ -140,14 +139,14 @@ An order...""" ...@@ -140,14 +139,14 @@ An order..."""
""" """
Returns 1 if not simulated or inconsistent target and values Returns 1 if not simulated or inconsistent target and values
""" """
if self.getSimulationState() not in draft_order_state: if self.getSimulationState() not in self.getPortalDraftOrderStateList():
if not self.isSimulated(): if not self.isSimulated():
return 1 return 1
return Delivery.isDivergent(self) return Delivery.isDivergent(self)
security.declareProtected(Permissions.ModifyPortalContent, 'updateAppliedRule') security.declareProtected(Permissions.ModifyPortalContent, 'updateAppliedRule')
def updateAppliedRule(self): def updateAppliedRule(self):
if self.getSimulationState() not in draft_order_state: if self.getSimulationState() not in self.getPortalDraftOrderStateList():
# Nothing to do if we are already simulated # Nothing to do if we are already simulated
self._createDeliveryRule() self._createDeliveryRule()
......
This diff is collapsed.
...@@ -34,7 +34,6 @@ from Products.ERP5Type.XMLObject import XMLObject ...@@ -34,7 +34,6 @@ from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Utils import asList, keepIn, rejectIn from Products.ERP5Type.Utils import asList, keepIn, rejectIn
from Products.ERP5.Variated import Variated from Products.ERP5.Variated import Variated
from Products.ERP5.ERP5Globals import resource_type_list, variation_type_list
from Products.ERP5.Document.Domain import Domain from Products.ERP5.Document.Domain import Domain
......
...@@ -37,7 +37,7 @@ from Products.ERP5Type.Base import TempBase ...@@ -37,7 +37,7 @@ from Products.ERP5Type.Base import TempBase
from Products.ERP5.Document.Amount import Amount from Products.ERP5.Document.Amount import Amount
from Products.ERP5.ERP5Globals import resource_type_list, variation_type_list from Products.CMFCore.Expression import Expression
from zLOG import LOG from zLOG import LOG
...@@ -131,7 +131,7 @@ class TransformedResource(XMLObject, XMLMatrix, Amount): ...@@ -131,7 +131,7 @@ class TransformedResource(XMLObject, XMLMatrix, Amount):
'description' : "", 'description' : "",
'type' : 'tokens', 'type' : 'tokens',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -588,7 +588,7 @@ identify a bank account.""" ...@@ -588,7 +588,7 @@ identify a bank account."""
variation_base_category_list, variation, base=1) variation_base_category_list, variation, base=1)
# and update the price with the variation price if necessary # and update the price with the variation price if necessary
for resource_variation in self.getValueList( for resource_variation in self.getValueList(
variation_base_category_list, portal_type=variation_type_list): variation_base_category_list, portal_type=self.getPortalVariationTypeList()):
if resource_variation.hasDefaultBasePrice(): if resource_variation.hasDefaultBasePrice():
new_base_price = resource_variation.getBasePrice() new_base_price = resource_variation.getBasePrice()
try: try:
...@@ -636,7 +636,7 @@ identify a bank account.""" ...@@ -636,7 +636,7 @@ identify a bank account."""
self.portal_categories.setCategoryMembership(line_item, base_category_list, self.portal_categories.setCategoryMembership(line_item, base_category_list,
mapped_value.getCategoryMembershipList(base_category_list, base=1), base=1) mapped_value.getCategoryMembershipList(base_category_list, base=1), base=1)
for resource_variation in mapped_value.getValueList(base_category_list, for resource_variation in mapped_value.getValueList(base_category_list,
portal_type=variation_type_list): portal_type=self.getPortalVariationTypeList()):
if resource_variation.hasDefaultBasePrice(): if resource_variation.hasDefaultBasePrice():
new_base_price = resource_variation.getBasePrice() new_base_price = resource_variation.getBasePrice()
try: try:
...@@ -705,4 +705,4 @@ identify a bank account.""" ...@@ -705,4 +705,4 @@ identify a bank account."""
) )
return [line_item], total_base_price, total_source_base_price, \ return [line_item], total_base_price, total_source_base_price, \
total_variated_base_price, total_variated_source_base_price, duration total_variated_base_price, total_variated_source_base_price, duration
...@@ -34,7 +34,8 @@ from Products.ERP5Type.XMLObject import XMLObject ...@@ -34,7 +34,8 @@ from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5Type.XMLMatrix import XMLMatrix
from Products.ERP5.Variated import Variated from Products.ERP5.Variated import Variated
from Products.ERP5Type.Utils import cartesianProduct from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5.ERP5Globals import resource_type_list
from Products.CMFCore.Expression import Expression
from zLOG import LOG from zLOG import LOG
...@@ -73,7 +74,7 @@ class VariatedProperty(XMLObject, XMLMatrix, Variated): ...@@ -73,7 +74,7 @@ class VariatedProperty(XMLObject, XMLMatrix, Variated):
'storage_id' : 'variation_base_category_list', 'storage_id' : 'variation_base_category_list',
'description' : "", 'description' : "",
'type' : 'tokens', 'type' : 'tokens',
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
......
...@@ -30,7 +30,6 @@ from AccessControl import ClassSecurityInfo ...@@ -30,7 +30,6 @@ from AccessControl import ClassSecurityInfo
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Rule import Rule from Products.ERP5.Document.Rule import Rule
from Products.ERP5.ERP5Globals import movement_type_list
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from zLOG import LOG from zLOG import LOG
......
from Products.ERP5.ERP5Globals import *
from Products.ERP5.Tool.Category import addBaseCategory from Products.ERP5.Tool.Category import addBaseCategory
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
...@@ -6,17 +5,21 @@ from Products.ERP5Type.Utils import convertToUpperCase ...@@ -6,17 +5,21 @@ from Products.ERP5Type.Utils import convertToUpperCase
def setBaseAcquisition(self): def setBaseAcquisition(self):
pc = self.portal_categories pc = self.portal_categories
# Source and destination are defined by delivery, order, parent # Source and destination are defined by delivery, order, parent
# we should not use causality here because of production reports # we should not use causality here because of production reports
# for which source or destination can be None (ie. different from Production Order) # for which source or destination can be None (ie. different from Production Order)
for bc in ('source', 'destination', for bc in ('source', 'destination',
'target_source', 'target_destination', 'target_source', 'target_destination',
'source_section', 'destination_section', 'source_section', 'destination_section',
'target_source_section', 'target_destination_section',): 'target_source_section', 'target_destination_section',):
if not hasattr(pc, bc): if not hasattr(pc, bc):
addBaseCategory(pc, bc) addBaseCategory(pc, bc)
pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', )) pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', ))
pc[bc].setAcquisitionPortalTypeList(movement_or_item_or_delivery_or_order_or_invoice_type_list) pc[bc].setAcquisitionPortalTypeList(self.getPortalAcquisitionMovementTypeList() + \
self.getPortalItemTypeList() + \
self.getPortalDeliveryTypeList() + \
self.getPortalOrderTypeList() + \
self.getPortalInvoiceTypeList())
pc[bc].setAcquisitionMaskValue(1) pc[bc].setAcquisitionMaskValue(1)
pc[bc].setAcquisitionCopyValue(0) pc[bc].setAcquisitionCopyValue(0)
pc[bc].setAcquisitionAppendValue(0) pc[bc].setAcquisitionAppendValue(0)
...@@ -28,7 +31,11 @@ def setBaseAcquisition(self): ...@@ -28,7 +31,11 @@ def setBaseAcquisition(self):
if not hasattr(pc, bc): if not hasattr(pc, bc):
addBaseCategory(pc, bc) addBaseCategory(pc, bc)
pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', 'causality')) pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', 'causality'))
pc[bc].setAcquisitionPortalTypeList(movement_or_item_or_delivery_or_order_or_invoice_type_list) pc[bc].setAcquisitionPortalTypeList(self.getPortalAcquisitionMovementTypeList() + \
self.getPortalItemTypeList() + \
self.getPortalDeliveryTypeList() + \
self.getPortalOrderTypeList() + \
self.getPortalInvoiceTypeList())
pc[bc].setAcquisitionMaskValue(1) pc[bc].setAcquisitionMaskValue(1)
pc[bc].setAcquisitionCopyValue(0) pc[bc].setAcquisitionCopyValue(0)
pc[bc].setAcquisitionAppendValue(0) pc[bc].setAcquisitionAppendValue(0)
...@@ -37,7 +44,11 @@ def setBaseAcquisition(self): ...@@ -37,7 +44,11 @@ def setBaseAcquisition(self):
if not hasattr(pc, bc): if not hasattr(pc, bc):
addBaseCategory(pc, bc) addBaseCategory(pc, bc)
pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent')) pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent'))
pc[bc].setAcquisitionPortalTypeList(movement_or_item_or_delivery_or_order_or_invoice_type_list) pc[bc].setAcquisitionPortalTypeList(self.getPortalAcquisitionMovementTypeList() + \
self.getPortalItemTypeList() + \
self.getPortalDeliveryTypeList() + \
self.getPortalOrderTypeList() + \
self.getPortalInvoiceTypeList())
pc[bc].setAcquisitionMaskValue(1) pc[bc].setAcquisitionMaskValue(1)
pc[bc].setAcquisitionCopyValue(0) pc[bc].setAcquisitionCopyValue(0)
pc[bc].setAcquisitionAppendValue(0) pc[bc].setAcquisitionAppendValue(0)
...@@ -46,7 +57,11 @@ def setBaseAcquisition(self): ...@@ -46,7 +57,11 @@ def setBaseAcquisition(self):
if not hasattr(pc, bc): if not hasattr(pc, bc):
addBaseCategory(pc, bc) addBaseCategory(pc, bc)
pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', )) pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', ))
pc[bc].setAcquisitionPortalTypeList(movement_or_item_or_delivery_or_order_or_invoice_type_list) pc[bc].setAcquisitionPortalTypeList(self.getPortalAcquisitionMovementTypeList() + \
self.getPortalItemTypeList() + \
self.getPortalDeliveryTypeList() + \
self.getPortalOrderTypeList() + \
self.getPortalInvoiceTypeList())
pc[bc].setAcquisitionMaskValue(1) pc[bc].setAcquisitionMaskValue(1)
pc[bc].setAcquisitionCopyValue(0) pc[bc].setAcquisitionCopyValue(0)
pc[bc].setAcquisitionAppendValue(0) pc[bc].setAcquisitionAppendValue(0)
...@@ -55,8 +70,12 @@ def setBaseAcquisition(self): ...@@ -55,8 +70,12 @@ def setBaseAcquisition(self):
if not hasattr(pc, bc): if not hasattr(pc, bc):
addBaseCategory(pc, bc) addBaseCategory(pc, bc)
pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', 'resource')) pc[bc].setAcquisitionBaseCategoryList(('delivery', 'order', 'parent', 'resource'))
pc[bc].setAcquisitionPortalTypeList( pc[bc].setAcquisitionPortalTypeList(self.getPortalAcquisitionMovementTypeList() + \
movement_or_item_or_delivery_or_order_or_invoice_or_resource_type_list) self.getPortalItemTypeList() + \
self.getPortalDeliveryTypeList() + \
self.getPortalOrderTypeList() + \
self.getPortalInvoiceTypeList() + \
self.getPortalResourceTypeList())
pc[bc].setAcquisitionMaskValue(1) pc[bc].setAcquisitionMaskValue(1)
pc[bc].setAcquisitionCopyValue(0) pc[bc].setAcquisitionCopyValue(0)
pc[bc].setAcquisitionAppendValue(0) pc[bc].setAcquisitionAppendValue(0)
...@@ -86,13 +105,13 @@ def setBaseAcquisition(self): ...@@ -86,13 +105,13 @@ def setBaseAcquisition(self):
pc[bc].setAcquisitionSyncValue(1) pc[bc].setAcquisitionSyncValue(1)
pc[bc].setAcquisitionObjectIdList(['default_career']) pc[bc].setAcquisitionObjectIdList(['default_career'])
# Immobilisation acquisition # Immobilisation acquisition
for bc in ('input_account', 'output_account', 'immobilisation_account', for bc in ('input_account', 'output_account', 'immobilisation_account',
'amortisation_account', 'depreciation_account', 'vat_account', 'amortisation_account', 'depreciation_account', 'vat_account',
'amortisation_type', ): 'amortisation_type', ):
if not hasattr(pc, bc): if not hasattr(pc, bc):
addBaseCategory(pc, bc) addBaseCategory(pc, bc)
pc[bc].setAcquisitionBaseCategoryList('parent',) pc[bc].setAcquisitionBaseCategoryList('parent',)
pc[bc].setAcquisitionPortalTypeList(item_type_list) pc[bc].setAcquisitionPortalTypeList(self.getPortalItemTypeList())
pc[bc].setAcquisitionMaskValue(1) pc[bc].setAcquisitionMaskValue(1)
pc[bc].setAcquisitionCopyValue(1) pc[bc].setAcquisitionCopyValue(1)
pc[bc].setAcquisitionAppendValue(0) pc[bc].setAcquisitionAppendValue(0)
......
This diff is collapsed.
...@@ -36,7 +36,6 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface ...@@ -36,7 +36,6 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass, DTMLFile from Globals import InitializeClass, DTMLFile
from Products.CMFCategory.Category import Category from Products.CMFCategory.Category import Category
from Products.ERP5.ERP5Globals import order_type_list, delivery_type_list
from zLOG import LOG from zLOG import LOG
manage_addRootMovementGroupForm=DTMLFile('dtml/SimulationTool_addRootMovementGroup', globals()) manage_addRootMovementGroupForm=DTMLFile('dtml/SimulationTool_addRootMovementGroup', globals())
...@@ -82,7 +81,7 @@ class RootMovementGroup(Folder): ...@@ -82,7 +81,7 @@ class RootMovementGroup(Folder):
""" """
This sets an appropriate nested class. This sets an appropriate nested class.
""" """
LOG('RootGroup.setNestedClass, check_list:',0,check_list) LOG('RootGroup.setNestedClass, check_list:',0,check_list)
for i in range(len(check_list)): for i in range(len(check_list)):
LOG('RootGroup.setNestedClass, check_list[i]:',0,check_list[i]) LOG('RootGroup.setNestedClass, check_list[i]:',0,check_list[i])
...@@ -164,12 +163,12 @@ class OrderMovementGroup(RootMovementGroup,Folder): ...@@ -164,12 +163,12 @@ class OrderMovementGroup(RootMovementGroup,Folder):
if hasattr(movement, 'getRootAppliedRule'): if hasattr(movement, 'getRootAppliedRule'):
# This is a simulation movement # This is a simulation movement
order_value = movement.getRootAppliedRule().getCausalityValue( order_value = movement.getRootAppliedRule().getCausalityValue(
portal_type=order_type_list) portal_type=movement.getPortalOrderTypeList())
if order_value is None: if order_value is None:
# In some cases (ex. DeliveryRule), there is no order # In some cases (ex. DeliveryRule), there is no order
# we may consider a PackingList as the order in the OrderGroup # we may consider a PackingList as the order in the OrderGroup
order_value = movement.getRootAppliedRule().getCausalityValue( order_value = movement.getRootAppliedRule().getCausalityValue(
portal_type=delivery_type_list) portal_type=movement.getPortalDeliveryTypeList())
else: else:
# This is a temp movement # This is a temp movement
order_value = None order_value = None
...@@ -184,13 +183,13 @@ class OrderMovementGroup(RootMovementGroup,Folder): ...@@ -184,13 +183,13 @@ class OrderMovementGroup(RootMovementGroup,Folder):
def test(self,movement): def test(self,movement):
if hasattr(movement, 'getRootAppliedRule'): if hasattr(movement, 'getRootAppliedRule'):
order_value = movement.getRootAppliedRule().getCausalityValue( order_value = movement.getRootAppliedRule().getCausalityValue(
portal_type=order_type_list) portal_type=movement.getPortalOrderTypeList())
if order_value is None: if order_value is None:
# In some cases (ex. DeliveryRule), there is no order # In some cases (ex. DeliveryRule), there is no order
# we may consider a PackingList as the order in the OrderGroup # we may consider a PackingList as the order in the OrderGroup
order_value = movement.getRootAppliedRule().getCausalityValue( order_value = movement.getRootAppliedRule().getCausalityValue(
portal_type=delivery_type_list) portal_type=movement.getPortalDeliveryTypeList())
else: else:
# This is a temp movement # This is a temp movement
order_value = None order_value = None
......
...@@ -26,27 +26,27 @@ ...@@ -26,27 +26,27 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Amortisation: class Amortisation:
""" """
Properties which allow to immobilise an item Properties which allow to immobilise an item
These properties are applied to an Immobilisation Movement or to an Item These properties are applied to an Immobilisation Movement or to an Item
TODO: TODO:
- rename categories for more genericity (input_acount -> input) - rename categories for more genericity (input_acount -> input)
- rename vat property - rename vat property
""" """
_properties = ( _properties = (
{ 'id' : 'amortisation_beginning_price', { 'id' : 'amortisation_beginning_price',
'description' : 'The value to use to calculate the accounting amortisation movements (net of tax)', 'description' : 'The value to use to calculate the accounting amortisation movements (net of tax)',
'type' : 'float', 'type' : 'float',
'acquisition_base_category' : ('parent',), 'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getAmortisationBeginningPrice', 'acquisition_accessor_id' : 'getAmortisationBeginningPrice',
...@@ -56,7 +56,7 @@ class Amortisation: ...@@ -56,7 +56,7 @@ class Amortisation:
'description' : 'The remaining amortisation duration in months', 'description' : 'The remaining amortisation duration in months',
'type' : 'int', 'type' : 'int',
'acquisition_base_category' : ('parent',), 'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getAmortisationDuration', 'acquisition_accessor_id' : 'getAmortisationDuration',
...@@ -66,7 +66,7 @@ class Amortisation: ...@@ -66,7 +66,7 @@ class Amortisation:
'description' : 'The item is immobilised after the movement', 'description' : 'The item is immobilised after the movement',
'type' : 'boolean', 'type' : 'boolean',
'acquisition_base_category' : ('parent',), 'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getImmobilisation', 'acquisition_accessor_id' : 'getImmobilisation',
...@@ -76,7 +76,7 @@ class Amortisation: ...@@ -76,7 +76,7 @@ class Amortisation:
'description' : 'The fiscal coefficient to use in degressive amortisation', 'description' : 'The fiscal coefficient to use in degressive amortisation',
'type' : 'float', 'type' : 'float',
'acquisition_base_category' : ('parent',), 'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getFiscalCoefficient', 'acquisition_accessor_id' : 'getFiscalCoefficient',
...@@ -86,15 +86,15 @@ class Amortisation: ...@@ -86,15 +86,15 @@ class Amortisation:
'description' : 'The VAT at the beginning of the immobilisation period', 'description' : 'The VAT at the beginning of the immobilisation period',
'type' : 'float', 'type' : 'float',
'acquisition_base_category' : ('parent',), 'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getVat', 'acquisition_accessor_id' : 'getVat',
'acquisition_depends' : None, 'acquisition_depends' : None,
'mode' : 'w' }, 'mode' : 'w' },
) )
_categories = ('input_account', 'output_account', 'immobilisation_account', _categories = ('input_account', 'output_account', 'immobilisation_account',
'amortisation_account', 'depreciation_account', 'amortisation_account', 'depreciation_account',
'vat_account', 'amortisation_type') # XXX Some rename required 'vat_account', 'amortisation_type') # XXX Some rename required
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
############################################################################## ##############################################################################
# This has to be chanegd and improved by the new category acquisition tool # This has to be chanegd and improved by the new category acquisition tool
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Amount: class Amount:
""" """
...@@ -48,7 +48,7 @@ class Amount: ...@@ -48,7 +48,7 @@ class Amount:
'description' : "The resource id involved", 'description' : "The resource id involved",
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -60,7 +60,7 @@ class Amount: ...@@ -60,7 +60,7 @@ class Amount:
'description' : "The resource relative url involved", 'description' : "The resource relative url involved",
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -71,7 +71,7 @@ class Amount: ...@@ -71,7 +71,7 @@ class Amount:
'description' : "The resource title involved", 'description' : "The resource title involved",
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -85,7 +85,7 @@ class Amount: ...@@ -85,7 +85,7 @@ class Amount:
'type' : 'float', 'type' : 'float',
'default' : 0.0, 'default' : 0.0,
'acquisition_base_category' : ('delivery',), 'acquisition_base_category' : ('delivery',),
'acquisition_portal_type' : movement_or_delivery_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalDeliveryTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getQuantity', 'acquisition_accessor_id' : 'getQuantity',
...@@ -97,7 +97,7 @@ class Amount: ...@@ -97,7 +97,7 @@ class Amount:
'type' : 'float', 'type' : 'float',
'default' : 1.0, 'default' : 1.0,
'acquisition_base_category' : ('delivery',), 'acquisition_base_category' : ('delivery',),
'acquisition_portal_type' : movement_or_delivery_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalDeliveryTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getEfficiency', 'acquisition_accessor_id' : 'getEfficiency',
...@@ -110,7 +110,7 @@ class Amount: ...@@ -110,7 +110,7 @@ class Amount:
'type' : 'float', 'type' : 'float',
'default' : 0.0, 'default' : 0.0,
'acquisition_base_category' : ('order',), 'acquisition_base_category' : ('order',),
'acquisition_portal_type' : movement_or_order_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalOrderTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getTargetQuantity', 'acquisition_accessor_id' : 'getTargetQuantity',
...@@ -121,7 +121,7 @@ class Amount: ...@@ -121,7 +121,7 @@ class Amount:
'type' : 'float', 'type' : 'float',
'default' : 1.0, 'default' : 1.0,
'acquisition_base_category' : ('order',), 'acquisition_base_category' : ('order',),
'acquisition_portal_type' : movement_or_order_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalOrderTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getTargetEfficiency', 'acquisition_accessor_id' : 'getTargetEfficiency',
......
This diff is collapsed.
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import *
from Products.ERP5.PropertySheet.Path import Path from Products.ERP5.PropertySheet.Path import Path
class Assignment(Path): class Assignment(Path):
...@@ -38,7 +37,7 @@ class Assignment(Path): ...@@ -38,7 +37,7 @@ class Assignment(Path):
{ 'id' : 'salary_coefficient', { 'id' : 'salary_coefficient',
'description' : 'A coefficient related to the salary classification of the person.', 'description' : 'A coefficient related to the salary classification of the person.',
'type' : 'int', 'type' : 'int',
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'salary_level', { 'id' : 'salary_level',
'description' : 'A level to classify the salary of the person.', 'description' : 'A level to classify the salary of the person.',
'type' : 'int', 'type' : 'int',
...@@ -46,7 +45,7 @@ class Assignment(Path): ...@@ -46,7 +45,7 @@ class Assignment(Path):
{ 'id' : 'collective_agreement_title', { 'id' : 'collective_agreement_title',
'description' : 'A title that identify the collective agreement of this person in the case of employee/employer relation.', 'description' : 'A title that identify the collective agreement of this person in the case of employee/employer relation.',
'type' : 'string', 'type' : 'string',
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'subordination_title', { 'id' : 'subordination_title',
'description' : 'The title of the organisation this person is subordinated to', 'description' : 'The title of the organisation this person is subordinated to',
'type' : 'string', 'type' : 'string',
...@@ -68,7 +67,7 @@ class Assignment(Path): ...@@ -68,7 +67,7 @@ class Assignment(Path):
'acquisition_accessor_id' : 'getDefaultAddressValue', 'acquisition_accessor_id' : 'getDefaultAddressValue',
'acquisition_depends' : None, 'acquisition_depends' : None,
'mode' : 'r' }, 'mode' : 'r' },
) )
_categories = ('activity', 'function', 'grade', 'role', 'skill', 'destination', 'group', 'product_line', 'subordination', 'region', ) _categories = ('activity', 'function', 'grade', 'role', 'skill', 'destination', 'group', 'product_line', 'subordination', 'region', )
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import *
class Container: class Container:
""" """
Properties of container Properties of container
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import order_type_list, order_or_delivery_type_list from Products.CMFCore.Expression import Expression
class Delivery: class Delivery:
""" """
...@@ -41,7 +41,7 @@ class Delivery: ...@@ -41,7 +41,7 @@ class Delivery:
'type' : 'lines', 'type' : 'lines',
'override' : 1, 'override' : 1,
'acquisition_base_category' : ('causality',), 'acquisition_base_category' : ('causality',),
'acquisition_portal_type' : order_or_delivery_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalOrderTypeList() + portal.getPortalDeliveryTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_accessor_id' : 'getId', 'acquisition_accessor_id' : 'getId',
...@@ -52,7 +52,7 @@ class Delivery: ...@@ -52,7 +52,7 @@ class Delivery:
'type' : 'lines', 'type' : 'lines',
'override' : 1, 'override' : 1,
'acquisition_base_category' : ('causality',), 'acquisition_base_category' : ('causality',),
'acquisition_portal_type' : order_or_delivery_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalOrderTypeList() + portal.getPortalDeliveryTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_accessor_id' : 'getTitle', 'acquisition_accessor_id' : 'getTitle',
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
############################################################################## ##############################################################################
# This has to be chanegd and improved by the new category acquisition tool # This has to be chanegd and improved by the new category acquisition tool
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Inventory: class Inventory:
""" """
...@@ -35,7 +35,7 @@ class Inventory: ...@@ -35,7 +35,7 @@ class Inventory:
No default value is set in order to allow No default value is set in order to allow
None inventory values in movements None inventory values in movements
""" """
_properties = ( _properties = (
...@@ -45,7 +45,7 @@ class Inventory: ...@@ -45,7 +45,7 @@ class Inventory:
'description' : """The quantity of items in stock after inventory.""", 'description' : """The quantity of items in stock after inventory.""",
'type' : 'float', 'type' : 'float',
'acquisition_base_category' : ('delivery',), 'acquisition_base_category' : ('delivery',),
'acquisition_portal_type' : movement_or_delivery_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalMovementTypeList() + portal.getPortalDeliveryTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getInventory', 'acquisition_accessor_id' : 'getInventory',
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Item: class Item:
""" """
...@@ -45,5 +46,5 @@ class Item: ...@@ -45,5 +46,5 @@ class Item:
'mode' : 'w' }, 'mode' : 'w' },
) )
_categories = tuple(['package_type'] + list(variation_base_category_list)) _categories = ('package_type', Expression('python: portal.getPortalVariationBaseCategoryList()'))
# XXX Please check if it is meaningful to add order cat to all items ? # XXX Please check if it is meaningful to add order cat to all items ?
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class ItemAggregation: class ItemAggregation:
...@@ -39,7 +39,7 @@ class ItemAggregation: ...@@ -39,7 +39,7 @@ class ItemAggregation:
'description' : 'list of ids of items', 'description' : 'list of ids of items',
'type' : 'lines', 'type' : 'lines',
'acquisition_base_category' : ('aggregate',), 'acquisition_base_category' : ('aggregate',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_accessor_id' : 'getId', 'acquisition_accessor_id' : 'getId',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -48,7 +48,7 @@ class ItemAggregation: ...@@ -48,7 +48,7 @@ class ItemAggregation:
'description' : 'list of titles of items', 'description' : 'list of titles of items',
'type' : 'lines', 'type' : 'lines',
'acquisition_base_category' : ('aggregate',), 'acquisition_base_category' : ('aggregate',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_accessor_id' : 'getTitle', 'acquisition_accessor_id' : 'getTitle',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -57,7 +57,7 @@ class ItemAggregation: ...@@ -57,7 +57,7 @@ class ItemAggregation:
'description' : 'list of ids of produced items', 'description' : 'list of ids of produced items',
'type' : 'lines', 'type' : 'lines',
'acquisition_base_category' : ('aggregate',), 'acquisition_base_category' : ('aggregate',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_accessor_id' : 'getId', 'acquisition_accessor_id' : 'getId',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -66,7 +66,7 @@ class ItemAggregation: ...@@ -66,7 +66,7 @@ class ItemAggregation:
'description' : 'list of ids of produced items', 'description' : 'list of ids of produced items',
'type' : 'lines', 'type' : 'lines',
'acquisition_base_category' : ('aggregate',), 'acquisition_base_category' : ('aggregate',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_accessor_id' : 'getTitle', 'acquisition_accessor_id' : 'getTitle',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -75,7 +75,7 @@ class ItemAggregation: ...@@ -75,7 +75,7 @@ class ItemAggregation:
'description' : 'list of ids of consumed items', 'description' : 'list of ids of consumed items',
'type' : 'lines', 'type' : 'lines',
'acquisition_base_category' : ('aggregate',), 'acquisition_base_category' : ('aggregate',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_accessor_id' : 'getId', 'acquisition_accessor_id' : 'getId',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -84,7 +84,7 @@ class ItemAggregation: ...@@ -84,7 +84,7 @@ class ItemAggregation:
'description' : 'list of ids of consumed items', 'description' : 'list of ids of consumed items',
'type' : 'lines', 'type' : 'lines',
'acquisition_base_category' : ('aggregate',), 'acquisition_base_category' : ('aggregate',),
'acquisition_portal_type' : item_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalItemTypeList()'),
'acquisition_copy_value' : 1, 'acquisition_copy_value' : 1,
'acquisition_accessor_id' : 'getTitle', 'acquisition_accessor_id' : 'getTitle',
'acquisition_depends' : None, 'acquisition_depends' : None,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Movement: class Movement:
""" """
...@@ -48,7 +48,7 @@ class Movement: ...@@ -48,7 +48,7 @@ class Movement:
'description' : 'The title of the order which defines contractual conditions', 'description' : 'The title of the order which defines contractual conditions',
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('order',), 'acquisition_base_category' : ('order',),
'acquisition_portal_type' : order_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalOrderTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_accessor_id' : 'getTitle', 'acquisition_accessor_id' : 'getTitle',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -58,7 +58,7 @@ class Movement: ...@@ -58,7 +58,7 @@ class Movement:
'description' : 'The id of the order which defines contractual conditions', 'description' : 'The id of the order which defines contractual conditions',
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('order',), 'acquisition_base_category' : ('order',),
'acquisition_portal_type' : order_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalOrderTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_accessor_id' : 'getId', 'acquisition_accessor_id' : 'getId',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -68,7 +68,7 @@ class Movement: ...@@ -68,7 +68,7 @@ class Movement:
'description' : 'The relative_url of the order which defines contractual conditions', 'description' : 'The relative_url of the order which defines contractual conditions',
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('order',), 'acquisition_base_category' : ('order',),
'acquisition_portal_type' : order_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalOrderTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_accessor_id' : 'getRelativeUrl', 'acquisition_accessor_id' : 'getRelativeUrl',
'acquisition_depends' : None, 'acquisition_depends' : None,
...@@ -76,5 +76,5 @@ class Movement: ...@@ -76,5 +76,5 @@ class Movement:
'mode' : 'w' }, 'mode' : 'w' },
) )
_categories = tuple(['order'] + list(variation_base_category_list)) _categories = ('order', Expression('python: portal.getPortalVariationBaseCategoryList()'))
# XXX Please check if it is meaningful to add order cat to all movemements ? # XXX Please check if it is meaningful to add order cat to all movemements ?
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Path: class Path:
""" """
...@@ -38,7 +38,7 @@ class Path: ...@@ -38,7 +38,7 @@ class Path:
'description' : "The resource id involved", 'description' : "The resource id involved",
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -49,7 +49,7 @@ class Path: ...@@ -49,7 +49,7 @@ class Path:
'description' : "The resource relative url involved", 'description' : "The resource relative url involved",
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -60,7 +60,7 @@ class Path: ...@@ -60,7 +60,7 @@ class Path:
'description' : "The resource title involved", 'description' : "The resource title involved",
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Price: class Price:
""" """
...@@ -39,7 +39,7 @@ class Price: ...@@ -39,7 +39,7 @@ class Price:
'description' : 'A typical per unit price', 'description' : 'A typical per unit price',
'type' : 'float', 'type' : 'float',
'acquisition_base_category' : ('order', 'delivery',), 'acquisition_base_category' : ('order', 'delivery',),
'acquisition_portal_type' : movement_or_delivery_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalMovementTypeList() + portal.getPortalDeliveryTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getPrice', 'acquisition_accessor_id' : 'getPrice',
...@@ -82,6 +82,6 @@ class Price: ...@@ -82,6 +82,6 @@ class Price:
'description' : 'A list of quantity values which define acceptable ranges', 'description' : 'A list of quantity values which define acceptable ranges',
'type' : 'float', 'type' : 'float',
'multivalued' : 1, 'multivalued' : 1,
'mode' : 'w' }, 'mode' : 'w' },
) )
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import * from Products.CMFCore.Expression import Expression
class Task: class Task:
""" """
...@@ -49,7 +49,7 @@ class Task: ...@@ -49,7 +49,7 @@ class Task:
'type' : 'date', 'type' : 'date',
'default' : None, 'default' : None,
'acquisition_base_category' : ('delivery', 'order', 'parent',), 'acquisition_base_category' : ('delivery', 'order', 'parent',),
'acquisition_portal_type' : movement_or_delivery_or_order_or_invoice_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getStartDate', 'acquisition_accessor_id' : 'getStartDate',
...@@ -61,7 +61,7 @@ class Task: ...@@ -61,7 +61,7 @@ class Task:
'type' : 'date', 'type' : 'date',
'default' : None, 'default' : None,
'acquisition_base_category' : ('delivery', 'order', 'parent',), 'acquisition_base_category' : ('delivery', 'order', 'parent',),
'acquisition_portal_type' : movement_or_delivery_or_order_or_invoice_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getStopDate', 'acquisition_accessor_id' : 'getStopDate',
...@@ -74,7 +74,7 @@ class Task: ...@@ -74,7 +74,7 @@ class Task:
'type' : 'date', 'type' : 'date',
'default' : None, 'default' : None,
'acquisition_base_category' : ('parent',), # Do not acquire through order 'acquisition_base_category' : ('parent',), # Do not acquire through order
'acquisition_portal_type' : movement_or_delivery_or_order_or_invoice_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getTargetStartDate', 'acquisition_accessor_id' : 'getTargetStartDate',
...@@ -86,7 +86,7 @@ class Task: ...@@ -86,7 +86,7 @@ class Task:
'type' : 'date', 'type' : 'date',
'default' : None, 'default' : None,
'acquisition_base_category' : ('parent',), # Do not acquire through order 'acquisition_base_category' : ('parent',), # Do not acquire through order
'acquisition_portal_type' : movement_or_delivery_or_order_or_invoice_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalAcquisitionMovementTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getTargetStopDate', 'acquisition_accessor_id' : 'getTargetStopDate',
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import resource_type_list from Products.CMFCore.Expression import Expression
class Transformation: class Transformation:
""" """
...@@ -71,7 +71,7 @@ class Transformation: ...@@ -71,7 +71,7 @@ class Transformation:
'description' : "The contact persons involved", 'description' : "The contact persons involved",
'type' : 'string', 'type' : 'string',
'acquisition_base_category' : ('resource',), 'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : resource_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0, 'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.ERP5Globals import invoice_or_invoice_movement_type_list from Products.CMFCore.Expression import Expression
class ValueAddedTax: class ValueAddedTax:
""" """
...@@ -40,7 +40,7 @@ class ValueAddedTax: ...@@ -40,7 +40,7 @@ class ValueAddedTax:
'description' : 'Ratio which should be applied to income to calculate VAT', 'description' : 'Ratio which should be applied to income to calculate VAT',
'type' : 'float', 'type' : 'float',
'acquisition_base_category' : ('parent',), 'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : invoice_or_invoice_movement_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalInvoiceTypeList() + portal.getPortalInvoiceMovementTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
...@@ -51,7 +51,7 @@ class ValueAddedTax: ...@@ -51,7 +51,7 @@ class ValueAddedTax:
'description' : 'Defines recoverability of the VAT', 'description' : 'Defines recoverability of the VAT',
'type' : 'boolean', 'type' : 'boolean',
'acquisition_base_category' : ('parent',), 'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : invoice_or_invoice_movement_type_list, 'acquisition_portal_type' : Expression('python: portal.getPortalInvoiceTypeList() + portal.getPortalInvoiceMovementTypeList()'),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1, 'acquisition_mask_value' : 1,
'acquisition_sync_value' : 0, 'acquisition_sync_value' : 0,
......
...@@ -32,7 +32,6 @@ from Products.ERP5Type.Document.Folder import Folder ...@@ -32,7 +32,6 @@ from Products.ERP5Type.Document.Folder import Folder
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5 import _dtmldir from Products.ERP5 import _dtmldir
from Products.ERP5.ERP5Globals import alarm_type_list
from Products.CMFCore import CMFCorePermissions from Products.CMFCore import CMFCorePermissions
from DateTime import DateTime from DateTime import DateTime
...@@ -91,7 +90,7 @@ class AlarmTool(BaseTool): ...@@ -91,7 +90,7 @@ class AlarmTool(BaseTool):
""" """
We retrieve thanks to the catalog the full list of alarms We retrieve thanks to the catalog the full list of alarms
""" """
catalog_search = self.portal_catalog(portal_type = alarm_type_list) catalog_search = self.portal_catalog(portal_type = self.getPortalAlarmTypeList())
alarm_list = map(lambda x:x.getObject(),catalog_search) alarm_list = map(lambda x:x.getObject(),catalog_search)
return alarm_list return alarm_list
......
This diff is collapsed.
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