Commit a8823f83 authored by Romain Courteaud's avatar Romain Courteaud

Remove _edit.

updateTargetQuantityFromContainerQuantity must be called in a
InteractionWorkflow if needed.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3085 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8371d558
############################################################################## ##############################################################################
# #
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002, 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com> # Jean-Paul Smets-Solanes <jp@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsability of assessing all potential
...@@ -54,9 +55,6 @@ class Container(Movement, XMLObject): ...@@ -54,9 +55,6 @@ class Container(Movement, XMLObject):
meta_type = 'ERP5 Container' meta_type = 'ERP5 Container'
portal_type = 'Container' portal_type = 'Container'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
...@@ -81,68 +79,6 @@ class Container(Movement, XMLObject): ...@@ -81,68 +79,6 @@ class Container(Movement, XMLObject):
, PropertySheet.SortIndex , PropertySheet.SortIndex
) )
# Factory Type Information
factory_type_information = \
{ 'id' : portal_type
, 'meta_type' : meta_type
, 'description' : """\
Une ligne tarifaire."""
, 'icon' : 'order_line_icon.gif'
, 'product' : 'ERP5'
, 'factory' : 'addContainer'
, 'immediate_view' : 'container_view'
, 'allow_discussion' : 1
, 'allowed_content_types': ('Container',
)
, 'filter_content_types' : 1
, 'global_allow' : 1
, 'actions' :
( { 'id' : 'view'
, 'name' : 'View'
, 'category' : 'object_view'
, 'action' : 'container_view'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'list'
, 'name' : 'Object Contents'
, 'category' : 'object_action'
, 'action' : 'folder_contents'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'print'
, 'name' : 'Print'
, 'category' : 'object_print'
, 'action' : 'order_line_print'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'metadata'
, 'name' : 'Metadata'
, 'category' : 'object_view'
, 'action' : 'metadata_edit'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'translate'
, 'name' : 'Translate'
, 'category' : 'object_action'
, 'action' : 'translation_template_view'
, 'permissions' : (
Permissions.TranslateContent, )
}
)
}
# Force in _edit to modify variation_base_category_list first
security.declarePrivate( '_edit' )
def _edit(self, REQUEST=None, force_update = 0, **kw):
# No Variations at this level
Movement._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
# Fire activity to update quantities in delivery lines
self.getDeliveryValue().activate().updateTargetQuantityFromContainerQuantity()
security.declareProtected(Permissions.AccessContentsInformation, 'getQuantity') security.declareProtected(Permissions.AccessContentsInformation, 'getQuantity')
def getQuantity(self): def getQuantity(self):
""" """
...@@ -190,9 +126,11 @@ Une ligne tarifaire.""" ...@@ -190,9 +126,11 @@ Une ligne tarifaire."""
container_cell_list = list(container_line.objectValues()) container_cell_list = list(container_line.objectValues())
container_cell_list.sort(lambda x, y: cmp(x.getVariationText(), y.getVariationText())) container_cell_list.sort(lambda x, y: cmp(x.getVariationText(), y.getVariationText()))
for container_cell in container_cell_list: for container_cell in container_cell_list:
result += "%s %s %s\n" % (container_cell.getResource(), container_cell.getTargetQuantity(), '|'.join(container_cell.getVariationText().split('\n'))) result += "%s %s %s\n" % (container_cell.getResource(),
container_cell.getQuantity(),
'|'.join(container_cell.getVariationText().split('\n')))
else: else:
result += "%s %s\n" % (container_line.getResource(), container_line.getTargetQuantity()) result += "%s %s\n" % (container_line.getResource(), container_line.getQuantity())
container_list = list(self.objectValues(spec = self.meta_type)) container_list = list(self.objectValues(spec = self.meta_type))
container_list.sort(lambda x, y: cmp(x.getContainerText(), y.getContainerText())) container_list.sort(lambda x, y: cmp(x.getContainerText(), y.getContainerText()))
more_result = "" more_result = ""
...@@ -253,4 +191,3 @@ Une ligne tarifaire.""" ...@@ -253,4 +191,3 @@ Une ligne tarifaire."""
if len(item_uid_list): return item_uid_list if len(item_uid_list): return item_uid_list
return (self.getUid(),) return (self.getUid(),)
\ No newline at end of file
############################################################################## ##############################################################################
# #
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002, 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com> # Jean-Paul Smets-Solanes <jp@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsability of assessing all potential
...@@ -48,9 +49,6 @@ class ContainerLine(DeliveryLine): ...@@ -48,9 +49,6 @@ class ContainerLine(DeliveryLine):
meta_type = 'ERP5 Container Line' meta_type = 'ERP5 Container Line'
portal_type = 'Container Line' portal_type = 'Container Line'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
...@@ -72,67 +70,6 @@ class ContainerLine(DeliveryLine): ...@@ -72,67 +70,6 @@ class ContainerLine(DeliveryLine):
, PropertySheet.ItemAggregation , PropertySheet.ItemAggregation
) )
# Factory Type Information
factory_type_information = \
{ 'id' : portal_type
, 'meta_type' : meta_type
, 'description' : """\
Une ligne tarifaire."""
, 'icon' : 'order_line_icon.gif'
, 'product' : 'ERP5'
, 'factory' : 'addContainerLine'
, 'immediate_view' : 'container_line_view'
, 'allow_discussion' : 1
, 'allowed_content_types': ('Container Cell',
)
, 'filter_content_types' : 1
, 'global_allow' : 1
, 'actions' :
( { 'id' : 'view'
, 'name' : 'View'
, 'category' : 'object_view'
, 'action' : 'container_line_view'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'list'
, 'name' : 'Object Contents'
, 'category' : 'object_action'
, 'action' : 'folder_contents'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'print'
, 'name' : 'Print'
, 'category' : 'object_print'
, 'action' : 'order_line_print'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'metadata'
, 'name' : 'Metadata'
, 'category' : 'object_view'
, 'action' : 'metadata_edit'
, 'permissions' : (
Permissions.View, )
}
, { 'id' : 'translate'
, 'name' : 'Translate'
, 'category' : 'object_action'
, 'action' : 'translation_template_view'
, 'permissions' : (
Permissions.TranslateContent, )
}
)
}
security.declarePrivate( '_edit' )
def _edit(self, REQUEST=None, force_update = 0, **kw):
# No Variations at this level
DeliveryLine._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
# Fire activity to update quantities in delivery lines
self.getDeliveryValue().activate().updateTargetQuantityFromContainerQuantity()
# Cell Related # Cell Related
security.declareProtected( Permissions.ModifyPortalContent, 'newCellContent' ) security.declareProtected( Permissions.ModifyPortalContent, 'newCellContent' )
def newCellContent(self, id,**kw): def newCellContent(self, id,**kw):
...@@ -169,9 +106,10 @@ Une ligne tarifaire.""" ...@@ -169,9 +106,10 @@ Une ligne tarifaire."""
""" """
Returns the quantity if no cell or the total quantity if cells Returns the quantity if no cell or the total quantity if cells
""" """
if not self.hasCellContent(): base_id = 'movement'
return self.getTargetQuantity() if not self.hasCellContent(base_id=base_id):
return self.getQuantity()
else: else:
# Use MySQL # Use MySQL
aggregate = self.ContainerLine_zGetTotal()[0] aggregate = self.ContainerLine_zGetTotal()[0]
return aggregate.total_quantity return aggregate.total_quantity or 0.0
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