From be16b58e0fccf1d7c89447dbe07d0359e89eccf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 24 Apr 2006 17:05:03 +0000 Subject: [PATCH] Remove references to "Piece Tissu" and other dead code git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6913 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/DeliveryCell.py | 49 -------- product/ERP5/Document/DeliveryLine.py | 59 +--------- product/ERP5/Document/InventoryCell.py | 152 ------------------------- product/ERP5/Document/InventoryLine.py | 151 +----------------------- 4 files changed, 7 insertions(+), 404 deletions(-) diff --git a/product/ERP5/Document/DeliveryCell.py b/product/ERP5/Document/DeliveryCell.py index 9f49f40421..3efe00b817 100644 --- a/product/ERP5/Document/DeliveryCell.py +++ b/product/ERP5/Document/DeliveryCell.py @@ -184,55 +184,6 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): # We have acquisition here which me should mimic return self.getParentValue().getQuantity() - def _setItemIdList(self, value): - """ - Computes total_quantity of all given items and stores this total_quantity - in the quantity attribute of the cell - """ - previous_item_list = self.getAggregateValueList() - given_item_id_list = value - item_object_list = [] - for item in given_item_id_list : - item_result_list = self.portal_catalog(id = item, - portal_type="Piece Tissu") - if len(item_result_list) == 1 : - try : - object = item_result_list[0].getObject() - except AttributeError: - object = None - else : - object = None - - if object is not None : - # if item was in previous_item_list keep it - if object in previous_item_list : - # we can add this item to the list of aggregated items - item_object_list.append(object) - # if new item verify if variated_resource of item == variated_resource of movement - elif (self.getResource() == object.getResource()) and (self.getVariationCategoryList() == object.getVariationCategoryList()) : - # now verify if item can be moved (not already done) - last_location_title = object.getLastLocationTitle() - if self.getDestinationTitle() != last_location_title or last_location_title == '' : - # we can add this item to the list of aggregated items - item_object_list.append(object) - - # update item_id_list and build relation - self.setAggregateValueList(item_object_list) - - # update quantity if needed - if len(item_object_list)>0 : - quantity = 0 - - for object_item in item_object_list : - if self.aq_parent.aq_parent.getPortalType() in ('Purchase Packing List', ) : - quantity += object_item.getQuantity() - else : - quantity += object_item.getRemainingQuantity() - # we reset the location of the item - object_item.setLocation('') - - self.setTargetQuantity(quantity) - # Required for indexing security.declareProtected(Permissions.AccessContentsInformation, 'getInventoriatedQuantity') diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py index 9c40712cad..4fdba4e272 100644 --- a/product/ERP5/Document/DeliveryLine.py +++ b/product/ERP5/Document/DeliveryLine.py @@ -26,18 +26,14 @@ # ############################################################################## -from Globals import InitializeClass, PersistentMapping from AccessControl import ClassSecurityInfo -from Acquisition import aq_base from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5Type.XMLObject import XMLObject -from Products.ERP5Type.Base import Base from Products.ERP5.Document.Movement import Movement from Products.ERP5.Variated import Variated -from Products.CMFCategory.Renderer import Renderer from Products.ERP5.Document.ImmobilisationMovement import ImmobilisationMovement from zLOG import LOG @@ -235,9 +231,7 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated, ImmobilisationMovem getattr(my_simulation_movement.getObject(), method_id)() def reindexObject(self, *k, **kw): - """ - Reindex children and simulation - """ + """Reindex children""" self.recursiveReindexObject(*k, **kw) security.declareProtected(Permissions.AccessContentsInformation, 'getInventoriatedQuantity') @@ -258,57 +252,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated, ImmobilisationMovem """ return Movement.getStopDate(self) - def _setItemIdList(self, value): - """ - Computes total_quantity of all given items and stores this total_quantity - in the quantity attribute of the cell - """ - if value is None: - return - previous_item_list = self.getAggregateValueList() - given_item_id_list = value - item_object_list = [] - for item in given_item_id_list : - item_result_list = self.portal_catalog(id = item, portal_type="Piece Tissu") - if len(item_result_list) == 1 : - try : - object = item_result_list[0].getObject() - except AttributeError: - object = None - else : - object = None - - if object is not None : - # if item was in previous_item_list keep it - if object in previous_item_list : - # we can add this item to the list of aggregated items - item_object_list.append(object) - # if new item verify if variated_resource of item == variated_resource of movement - elif (self.getResource() == object.getResource()) and (self.getVariationCategoryList() == object.getVariationCategoryList()) : - # now verify if item can be moved (not already done) - last_location_title = object.getLastLocationTitle() - if self.getDestinationTitle() != last_location_title or last_location_title == '' : - # we can add this item to the list of aggregated items - item_object_list.append(object) - - # update item_id_list and build relation - self.setAggregateValueList(item_object_list) - - # update quantity if needed - if len(item_object_list)>0 : - quantity = 0 - - for object_item in item_object_list : - if self.aq_parent.getPortalType() in ('Purchase Packing List', ) : - quantity += object_item.getQuantity() - else : - quantity += object_item.getRemainingQuantity() - # we reset the location of the item - object_item.setLocation('') - - self.setTargetQuantity(quantity) - - # security.declarePrivate('_checkConsistency') # def _checkConsistency(self, fixit=0, mapped_value_property_list = ('quantity', 'price')): # """ diff --git a/product/ERP5/Document/InventoryCell.py b/product/ERP5/Document/InventoryCell.py index eea24a041e..23b3aed9a9 100644 --- a/product/ERP5/Document/InventoryCell.py +++ b/product/ERP5/Document/InventoryCell.py @@ -108,158 +108,6 @@ class InventoryCell(DeliveryCell): else: return None - -# XXX Following methods should be useless now -# security.declareProtected( Permissions.AccessContentsInformation, 'getInventory' ) -# def getInventory(self): -# """ -# No acquisition for inventories: either defined or None -# """ -# if 'inventory' in self.getMappedValuePropertyList([]): -# return getattr(aq_base(self), 'inventory', None) -# else: -# return None # return None -# -# def _setItemIdList(self, value): -# """ -# Computes total_quantity of all given items and stores this total_quantity -# in the inventory attribute of the cell -# """ -# if value is None: -# return -# previous_item_list = self.getAggregateValueList() -# given_item_id_list = value -# item_object_list = [] -# for item in given_item_id_list: -# item_result_list = self.portal_catalog(id=item, portal_type="Piece Tissu") -# if len(item_result_list) == 1: -# try: -# object = item_result_list[0].getObject() -# except: -# object = None -# else: -# object = None -# if object is not None: -# # if item was in previous_item_list keep it -# if object in previous_item_list: -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # if new item verify if variated_resource of item == variated_resource of movement -# elif (self.getResource() == object.getResource()) \ -# and (self.getVariationCategoryList() == object.getVariationCategoryList()): -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # update item_id_list and build relation -# self.setAggregateValueList(item_object_list) -# # update inventory if needed -# if len(item_object_list) > 0: -# quantity = 0 -# for object_item in item_object_list: -# quantity += object_item.getRemainingQuantity() -# self.setInventory(quantity) -# -# def _setProducedItemIdList(self, value): -# """ -# Computes total_quantity of all given items and stores this total_quantity -# in the quantity attribute of the cell -# """ -# if value is None: -# return -# previous_item_list = self.getAggregateValueList() -# given_item_id_list = value -# item_object_list = [] -# for item in given_item_id_list: -# item_result_list = self.portal_catalog(id=item, portal_type="Piece Tissu") -# if len(item_result_list) == 1: -# try: -# object = item_result_list[0].getObject() -# except: -# object = None -# else: -# object = None -# if object is not None: -# # if item was in previous_item_list keep it -# if object in previous_item_list: -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # if new item verify if variated_resource of item == variated_resource of movement -# elif (self.getResource() == object.getResource()) \ -# and (self.getVariationCategoryList() == object.getVariationCategoryList()): -# # now verify if item can be moved (not already done) -# last_location_title = object.getLastLocationTitle() -# if self.getDestinationTitle() != last_location_title or last_location_title == '': -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # update item_id_list and build relation -# self.setAggregateValueList(item_object_list) -# # update inventory if needed -# if len(item_object_list) > 0: -# quantity = 0 -# for object_item in item_object_list: -# quantity += object_item.getQuantity() -# self.setProductionQuantity(quantity) -# -# def _setConsumedItemIdList(self, value): -# """ -# Computes total_quantity of all given items and stores this total_quantity -# in the quantity attribute of the cell -# """ -# if value is None: -# return -# previous_item_list = self.getAggregateValueList() -# given_item_id_list = value -# item_object_list = [] -# for item in given_item_id_list: -# item_result_list = self.portal_catalog(id=item, portal_type="Piece Tissu") -# if len(item_result_list) == 1: -# try : -# object = item_result_list[0].getObject() -# except : -# object = None -# else : -# object = None -# if object is not None: -# # if item was in previous_item_list keep it -# if object in previous_item_list: -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # if new item verify if variated_resource of item == variated_resource of movement -# elif (self.getResource() == object.getResource()) \ -# and (self.getVariationCategoryList() == object.getVariationCategoryList()): -# # now verify if item can be moved (not already done) -# last_location_title = object.getLastLocationTitle() -# if self.getDestinationTitle() == last_location_title or last_location_title == '': -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # update item_id_list and build relation -# self.setAggregateValueList(item_object_list) -# # update inventory if needed -# if len(item_object_list) > 0: -# quantity = 0 -# for object_item in item_object_list: -# quantity += object_item.getRemainingQuantity() -# # we reset the location of the item -# object_item.setLocation('') -# self.setConsumptionQuantity(quantity) -# -# def getProducedItemIdList(self): -# """ -# Returns list of items if production_quantity != 0.0 -# """ -# if self.getProductionQuantity() != 0.0: -# return self.getItemIdList() -# else: -# return [] -# -# def getConsumedItemIdList(self): -# """ -# Returns list of items if consumption_quantity != 0.0 -# """ -# if self.getConsumptionQuantity() != 0.0: -# return self.getItemIdList() -# else: -# return [] - # Inventory cataloging security.declareProtected(Permissions.AccessContentsInformation, 'getConvertedInventory') def getConvertedInventory(self): diff --git a/product/ERP5/Document/InventoryLine.py b/product/ERP5/Document/InventoryLine.py index 00c65cf8a5..80db2f7290 100644 --- a/product/ERP5/Document/InventoryLine.py +++ b/product/ERP5/Document/InventoryLine.py @@ -30,7 +30,6 @@ from AccessControl import ClassSecurityInfo from Acquisition import aq_base from Products.ERP5Type import Permissions, PropertySheet, Interface -from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5.Document.DeliveryLine import DeliveryLine from Products.ERP5.Document.Movement import Movement @@ -100,7 +99,8 @@ class InventoryLine(DeliveryLine): total_quantity += cell.getInventory() return total_quantity - security.declareProtected(Permissions.AccessContentsInformation, 'getQuantity') + security.declareProtected(Permissions.AccessContentsInformation, + 'getQuantity') def getQuantity(self): """ Computes a quantity which allows to reach inventory @@ -117,149 +117,9 @@ class InventoryLine(DeliveryLine): else: return None -# XXX Following method should be useless now -# def _setItemIdList(self, value): -# """ -# Computes total_quantity of all given items and stores this total_quantity -# in the inventory attribute of the cell -# """ -# if value is None: -# return -# previous_item_list = self.getAggregateValueList() -# given_item_id_list = value -# item_object_list = [] -# for item in given_item_id_list: -# item_result_list = self.portal_catalog(id=item, portal_type="Piece Tissu") -# if len(item_result_list) == 1: -# try: -# object = item_result_list[0].getObject() -# except : -# object = None -# else: -# object = None -# if object is not None: -# # if item was in previous_item_list keep it -# if object in previous_item_list: -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # if new item verify if variated_resource of item == variated_resource of movement -# elif (self.getResource() == object.getResource()) \ -# and (self.getVariationCategoryList() == object.getVariationCategoryList()): -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # update item_id_list and build relation -# self.setAggregateValueList(item_object_list) -# # update inventory if needed -# if len(item_object_list) > 0: -# quantity = 0 -# for object_item in item_object_list: -# quantity += object_item.getQuantity() -# self.setInventory(quantity) -# -# def _setProducedItemIdList(self, value): -# """ -# Computes total_quantity of all given items and stores this total_quantity -# in the quantity attribute of the cell -# """ -# if value is None: -# return -# previous_item_list = self.getAggregateValueList() -# given_item_id_list = value -# item_object_list = [] -# for item in given_item_id_list: -# item_result_list = self.portal_catalog(id=item, portal_type="Piece Tissu") -# if len(item_result_list) == 1: -# try: -# object = item_result_list[0].getObject() -# except: -# object = None -# else: -# object = None -# if object is not None: -# # if item was in previous_item_list keep it -# if object in previous_item_list: -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # if new item verify if variated_resource of item == variated_resource of movement -# elif (self.getResource() == object.getResource()) \ -# and (self.getVariationCategoryList() == object.getVariationCategoryList()): -# # now verify if item can be moved (not already done) -# last_location_title = object.getLastLocationTitle() -# if self.getDestinationTitle() != last_location_title or last_location_title == '': -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # update item_id_list and build relation -# self.setAggregateValueList(item_object_list) -# # update inventory if needed -# if len(item_object_list) > 0: -# quantity = 0 -# for object_item in item_object_list: -# quantity += object_item.getQuantity() -# self.setProductionQuantity(quantity) -# -# def _setConsumedItemIdList(self, value): -# """ -# Computes total_quantity of all given items and stores this total_quantity -# in the quantity attribute of the cell -# """ -# if value is None: -# return -# previous_item_list = self.getAggregateValueList() -# given_item_id_list = value -# item_object_list = [] -# for item in given_item_id_list: -# item_result_list = self.portal_catalog(id=item, portal_type="Piece Tissu") -# if len(item_result_list) == 1: -# try: -# object = item_result_list[0].getObject() -# except: -# object = None -# else: -# object = None -# if object is not None: -# # if item was in previous_item_list keep it -# if object in previous_item_list: -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # if new item verify if variated_resource of item == variated_resource of movement -# elif (self.getResource() == object.getResource()) \ -# and (self.getVariationCategoryList() == object.getVariationCategoryList()): -# # now verify if item can be moved (not already done) -# last_location_title = object.getLastLocationTitle() -# if self.getDestinationTitle() == last_location_title or last_location_title == '': -# # we can add this item to the list of aggregated items -# item_object_list.append(object) -# # update item_id_list and build relation -# self.setAggregateValueList(item_object_list) -# # update inventory if needed -# if len(item_object_list) > 0: -# quantity = 0 -# for object_item in item_object_list: -# quantity += object_item.getRemainingQuantity() -# # we reset the location of the item -# object_item.setLocation('') -# self.setConsumptionQuantity(quantity) -# -# def getProducedItemIdList(self): -# """ -# Returns list of items if production_quantity != 0.0 -# """ -# if self.getProductionQuantity() != 0.0: -# return self.getItemIdList() -# else: -# return [] -# -# def getConsumedItemIdList(self): -# """ -# Returns list of items if consumption_quantity != 0.0 -# """ -# if self.getConsumptionQuantity() != 0.0: -# return self.getItemIdList() -# else: -# return [] - # Inventory cataloging - security.declareProtected(Permissions.AccessContentsInformation, 'getConvertedInventory') + security.declareProtected(Permissions.AccessContentsInformation, + 'getConvertedInventory') def getConvertedInventory(self): """ provides a default inventory value - None since @@ -268,7 +128,8 @@ class InventoryLine(DeliveryLine): return self.getInventory() # XXX quantity unit is missing # Required for indexing - security.declareProtected(Permissions.AccessContentsInformation, 'getInventoriatedQuantity') + security.declareProtected(Permissions.AccessContentsInformation, + 'getInventoriatedQuantity') def getInventoriatedQuantity(self): """ Take into account efficiency in converted target quantity -- 2.30.9