From 37129c23dfc7a21c1965e3f7634c54782d3f0e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Tue, 5 Feb 2013 14:58:52 +0100 Subject: [PATCH] Remove obsolete APIs getSimulationQuantity/Source/Destination.. getOrderQuantity/Source/Destination... getDeliveryQuantity/Source/Destination... Those methods were not used and were calling some non existing ZSQL Methods XXX wrong ! getSimulationQuantity is used ! --- .../OrderLine_zGetRelatedQuantity.xml | 76 -------- product/ERP5/Document/DeliveryCell.py | 16 -- product/ERP5/Document/DeliveryLine.py | 39 ---- product/ERP5/Document/Movement.py | 176 ------------------ product/ERP5/Document/OrderLine.py | 10 - 5 files changed, 317 deletions(-) delete mode 100644 bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderLine_zGetRelatedQuantity.xml diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderLine_zGetRelatedQuantity.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderLine_zGetRelatedQuantity.xml deleted file mode 100644 index f052b9948c..0000000000 --- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderLine_zGetRelatedQuantity.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="SQL" module="Products.ZSQLMethods.SQL"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>allow_simple_one_argument_traversal</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>arguments_src</string> </key> - <value> <string>uid</string> </value> - </item> - <item> - <key> <string>cache_time_</string> </key> - <value> <int>0</int> </value> - </item> - <item> - <key> <string>class_file_</string> </key> - <value> <string>ZSQLCatalog.zsqlbrain</string> </value> - </item> - <item> - <key> <string>class_name_</string> </key> - <value> <string>ZSQLBrain</string> </value> - </item> - <item> - <key> <string>connection_hook</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>connection_id</string> </key> - <value> <string>erp5_sql_connection</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>OrderLine_zGetRelatedQuantity</string> </value> - </item> - <item> - <key> <string>max_cache_</string> </key> - <value> <int>100</int> </value> - </item> - <item> - <key> <string>max_rows_</string> </key> - <value> <int>1000</int> </value> - </item> - <item> - <key> <string>src</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -SELECT\n - SUM(movement.quantity) AS quantity\n -FROM\n - category, movement\n -WHERE\n - category.category_uid = <dtml-sqlvar uid type="int">\n -AND\n - category.uid = movement.uid\n -AND\n - category.base_category_uid = <dtml-sqlvar expr="portal_categories.order.getUid()" type="int">\n - - -]]></string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/product/ERP5/Document/DeliveryCell.py b/product/ERP5/Document/DeliveryCell.py index 00d09b464a..1d2f7ebab1 100644 --- a/product/ERP5/Document/DeliveryCell.py +++ b/product/ERP5/Document/DeliveryCell.py @@ -108,22 +108,6 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): """ return self.getParentValue().getRootDeliveryValue() - # Simulation Consistency Check - def getSimulationQuantity(self): - """ - Computes the quantities in the simulation - """ - if isinstance(self, OrderLine): - result = self.OrderLine_zGetRelatedQuantity(uid=self.getUid()) - if len(result) > 0: - return result[0].quantity - return None - else: - result = self.DeliveryLine_zGetRelatedQuantity(uid=self.getUid()) - if len(result) > 0: - return result[0].quantity - return None - security.declareProtected( Permissions.ModifyPortalContent, 'notifyAfterUpdateRelatedContent' ) def notifyAfterUpdateRelatedContent(self, previous_category_url, diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py index 8e0981b722..0bd5e84ae0 100644 --- a/product/ERP5/Document/DeliveryLine.py +++ b/product/ERP5/Document/DeliveryLine.py @@ -306,45 +306,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, ImmobilisationMovement): # # return error_list - # Simulation Consistency Check - def getSimulationQuantity(self): - """ - Computes the quantities in the simulation - """ - if not self.hasCellContent(): - result = self.DeliveryLine_zGetRelatedQuantity(uid=self.getUid()) - if len(result) > 0: - return result[0].quantity - return None - - def getSimulationSourceList(self): - """ - Computes the sources in the simulation - """ - result = self.DeliveryLine_zGetRelatedSource(uid=self.getUid()) - return map(lambda x: x.source, result) - - def getSimulationDestinationList(self): - """ - Computes the destinations in the simulation - """ - result = self.DeliveryLine_zGetRelatedDestination(uid=self.getUid()) - return map(lambda x: x.destination, result) - - def getSimulationSourceSectionList(self): - """ - Computes the source sections in the simulation - """ - result = self.DeliveryLine_zGetRelatedSourceSection(uid=self.getUid()) - return map(lambda x: x.source_section, result) - - def getSimulationDestinationSectionList(self): - """ - Computes the destination sections in the simulation - """ - result = self.DeliveryLine_zGetRelatedDestinationSection(uid=self.getUid()) - return map(lambda x: x.destination_section, result) - security.declareProtected(Permissions.AccessContentsInformation, 'getRootDeliveryValue') def getRootDeliveryValue(self): diff --git a/product/ERP5/Document/Movement.py b/product/ERP5/Document/Movement.py index 5ba9ded36d..5bbc52ddf3 100644 --- a/product/ERP5/Document/Movement.py +++ b/product/ERP5/Document/Movement.py @@ -591,182 +591,6 @@ class Movement(XMLObject, Amount, CompositionMixin, AmountGeneratorMixin): return simulation_movement is not None and \ not simulation_movement.getParentValue().isRootAppliedRule() - # New Causality API - security.declareProtected( Permissions.AccessContentsInformation, - 'getOrderQuantity') - def getOrderQuantity(self): - """ - Returns the quantity of related order(s) - """ - # XXX deprecated - return self.getQuantity() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getDeliveryQuantity') - def getDeliveryQuantity(self): - """ - Returns the quantity of related delivery(s) - """ - return self.getQuantity() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getSimulationQuantity') - def getSimulationQuantity(self): - """ - Returns the sum of quantities in related simulation movements - """ - return self.getQuantity() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getOrderStartDateList') - def getOrderStartDateList(self): - """ - Returns the list of start date of related order(s) - """ - # XXX deprecated - return [self.getStartDate()] - - security.declareProtected( Permissions.AccessContentsInformation, - 'getDeliveryStartDateList') - def getDeliveryStartDateList(self): - """ - Returns the list of start date of related delivery(s) - """ - return [self.getStartDate()] - - security.declareProtected( Permissions.AccessContentsInformation, - 'getSimulationStartDateList') - def getSimulationStartDateList(self): - """ - Returns the list of start date related simulation movements - """ - return [self.getStartDate()] - - security.declareProtected( Permissions.AccessContentsInformation, - 'getOrderStopDateList') - def getOrderStopDateList(self): - """ - Returns the list of stop date of related order(s) - """ - # XXX deprecated - return [self.getStopDate()] - - security.declareProtected( Permissions.AccessContentsInformation, - 'getDeliveryStopDateList') - def getDeliveryStopDateList(self): - """ - Returns the list of stop date of related delivery(s) - """ - return [self.getStopDate()] - - security.declareProtected( Permissions.AccessContentsInformation, - 'getSimulationStopDateList') - def getSimulationStopDateList(self): - """ - Returns the list of stop date related simulation movements - """ - return [self.getStopDate()] - - security.declareProtected( Permissions.AccessContentsInformation, - 'getOrderSourceList') - def getOrderSourceList(self): - """ - Returns the source of related orders - """ - # XXX deprecated - return self.getSourceList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getDeliverySourceList') - def getDeliverySourceList(self): - """ - Returns the source of related deliveries - """ - return self.getSourceList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getSimulationSourceList') - def getSimulationSourceList(self): - """ - Returns the source of related simulation movements - """ - return self.getSourceList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getOrderDestinationList') - def getOrderDestinationList(self): - """ - Returns the destination of related orders - """ - # XXX deprecated - return self.getDestinationList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getDeliveryDestinationList') - def getDeliveryDestinationList(self): - """ - Returns the destination of related deliveries - """ - return self.getDestinationList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getSimulationDestinationList') - def getSimulationDestinationList(self): - """ - Returns the destination of related simulation movements - """ - return self.getDestinationList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getOrderSourceSectionList') - def getOrderSourceSectionList(self): - """ - Returns the source_section of related orders - """ - # XXX deprecated - return self.getSourceSectionList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getDeliverySourceSectionList') - def getDeliverySourceSectionList(self): - """ - Returns the source_section of related deliveries - """ - return self.getSourceSectionList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getSimulationSourceSectionList') - def getSimulationSourceSectionList(self): - """ - Returns the source_section of related simulation movements - """ - return self.getSourceSectionList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getOrderDestinationSectionList') - def getOrderDestinationSectionList(self): - """ - Returns the destination_section of related orders - """ - # XXX deprecated - return self.getDestinationSectionList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getDeliveryDestinationSectionList') - def getDeliveryDestinationSectionList(self): - """ - Returns the destination_section of related deliveries - """ - return self.getDestinationSectionList() - - security.declareProtected( Permissions.AccessContentsInformation, - 'getSimulationDestinationSectionList') - def getSimulationDestinationSectionList(self): - """ - Returns the destination_section of related simulation movements - """ - return self.getDestinationSectionList() - # Debit and credit methods security.declareProtected( Permissions.AccessContentsInformation, 'getSourceDebit') diff --git a/product/ERP5/Document/OrderLine.py b/product/ERP5/Document/OrderLine.py index b9f615007d..a6d0477635 100644 --- a/product/ERP5/Document/OrderLine.py +++ b/product/ERP5/Document/OrderLine.py @@ -77,13 +77,3 @@ class OrderLine(DeliveryLine): # And apply getattr(my_simulation_movement, method_id)() - # Simulation Consistency Check - def getSimulationQuantity(self): - """ - Computes the target quantities in the simulation - """ - result = self.OrderLine_zGetRelatedQuantity(uid=self.getUid()) - if len(result) > 0: - return result[0].quantity - return None - -- 2.30.9