diff --git a/product/ERP5/Document/DeliveryCell.py b/product/ERP5/Document/DeliveryCell.py index 48f054df83a196d8e10505cac2cd8f3b370ef19a..9f49f404215b748a682c86dd0875737a191cc7cc 100644 --- a/product/ERP5/Document/DeliveryCell.py +++ b/product/ERP5/Document/DeliveryCell.py @@ -160,13 +160,15 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): # Call a script on the context if 'price' in self.getMappedValuePropertyList([]): if getattr(aq_base(self), 'price', None) is not None: - return getattr(self, 'price') # default returns a price defined by the mapped value + # default returns a price defined by the mapped value + return getattr(self, 'price') else: - return self.aq_parent.getProperty('price') # Price is acquired + return self.getParentValue().getProperty('price') # Price is acquired else: return None - security.declareProtected( Permissions.AccessContentsInformation, 'getQuantity' ) + security.declareProtected( Permissions.AccessContentsInformation, + 'getQuantity' ) def getQuantity(self): """ Returns the quantity if defined on the cell @@ -177,10 +179,10 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): if getattr(aq_base(self), 'quantity', None) is not None: return getattr(self, 'quantity') else: - return self.aq_parent.getProperty('quantity') + return self.getParentValue().getProperty('quantity') else: - return self.getParent().getQuantity() # We have acquisition here which me should mimic - # return None + # We have acquisition here which me should mimic + return self.getParentValue().getQuantity() def _setItemIdList(self, value): """ @@ -191,7 +193,8 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): 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") + 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() @@ -230,36 +233,35 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): self.setTargetQuantity(quantity) -# security.declareProtected(Permissions.ModifyPortalContent, 'applyTargetSolver') -# def applyTargetSolver(self, solver): -# for my_simulation_movement in self.getDeliveryRelatedValueList(portal_type = 'Simulation Movement'): -# self.portal_simulation.applyTargetSolver(my_simulation_movement, solver) - # Required for indexing - security.declareProtected(Permissions.AccessContentsInformation, 'getInventoriatedQuantity') + security.declareProtected(Permissions.AccessContentsInformation, + 'getInventoriatedQuantity') def getInventoriatedQuantity(self): """ """ return Movement.getInventoriatedQuantity(self) - security.declareProtected(Permissions.AccessContentsInformation, 'getStartDate') + security.declareProtected(Permissions.AccessContentsInformation, + 'getStartDate') def getStartDate(self): """ """ return self._baseGetStartDate() - security.declareProtected(Permissions.AccessContentsInformation, 'getStopDate') + security.declareProtected(Permissions.AccessContentsInformation, + 'getStopDate') def getStopDate(self): """ """ return self._baseGetStopDate() - security.declareProtected(Permissions.AccessContentsInformation, 'getStopDate') + security.declareProtected(Permissions.AccessContentsInformation, + 'getRootDeliveryValue') def getRootDeliveryValue(self): """ Returns the root delivery responsible of this cell """ - return self.getParent().getRootDeliveryValue() + return self.getParentValue().getRootDeliveryValue() # Simulation Consistency Check def getSimulationQuantity(self): @@ -277,16 +279,20 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): return result[0].quantity return None - security.declareProtected( Permissions.ModifyPortalContent, 'notifyAfterUpdateRelatedContent' ) - def notifyAfterUpdateRelatedContent(self, previous_category_url, new_category_url): + security.declareProtected( Permissions.ModifyPortalContent, + 'notifyAfterUpdateRelatedContent' ) + def notifyAfterUpdateRelatedContent(self, previous_category_url, + new_category_url): """ Membership Crirerions and Category List are same in DeliveryCell Must update it (or change implementation to remove data duplication) """ update_method = self.portal_categories.updateRelatedCategory predicate_value = self.getPredicateValueList() - new_predicate_value = map(lambda c: update_method(c, previous_category_url, new_category_url), predicate_value) - self._setPredicateValueList(new_predicate_value) # No reindex needed since uid stable + new_predicate_value = map(lambda c: update_method(c, + previous_category_url, new_category_url), predicate_value) + self._setPredicateValueList(new_predicate_value) + # No reindex needed since uid stable # XXX FIXME: option variation are today not well implemented # This little hack is needed to make the matrixbox working @@ -309,14 +315,16 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): if kw.has_key('item_id_list'): self._setItemIdList(kw['item_id_list']) - security.declareProtected(Permissions.ModifyPortalContent, 'updateSimulationDeliveryProperties') + security.declareProtected(Permissions.ModifyPortalContent, + 'updateSimulationDeliveryProperties') def updateSimulationDeliveryProperties(self, movement_list = None): """ - Set properties delivery_ratio and delivery_error for each simulation movement - in movement_list (all movements by default), according to this delivery calculated quantity + Set properties delivery_ratio and delivery_error for each + simulation movement in movement_list (all movements by default), + according to this delivery calculated quantity """ - parent = self.getParent() + parent = self.getParentValue() if parent is not None: - parent = parent.getParent() + parent = parent.getParentValue() if parent is not None: parent.updateSimulationDeliveryProperties(movement_list, self) diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py index 24b8c74dcdc41f051f901b48b67b244ec9072888..9c40712cadb759fc6d39e45ccb346c2bfde680e6 100644 --- a/product/ERP5/Document/DeliveryLine.py +++ b/product/ERP5/Document/DeliveryLine.py @@ -78,15 +78,15 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated, ImmobilisationMovem updateRelatedContent = XMLMatrix.updateRelatedContent # Explicit acquisition of aq_dynamic generated method - security.declareProtected(Permissions.AccessContentsInformation, + security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationState') def getSimulationState(self): """ Explicitly acquire simulation_state from parent """ - if hasattr(self.getParent(),'getSimulationState'): - return self.getParent().getSimulationState() - return None + method = getattr(self.getParentValue(),'getSimulationState', None) + if method is not None: + return method() # Force in _edit to modify variation_base_category_list first security.declarePrivate( '_edit' ) @@ -383,19 +383,22 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated, ImmobilisationMovem result = self.DeliveryLine_zGetRelatedDestinationSection(uid=self.getUid()) return map(lambda x: x.destination_section, result) - security.declareProtected(Permissions.AccessContentsInformation, 'getStopDate') + security.declareProtected(Permissions.AccessContentsInformation, + 'getRootDeliveryValue') def getRootDeliveryValue(self): """ Returns the root delivery responsible of this line """ - return self.getParent().getRootDeliveryValue() + return self.getParentValue().getRootDeliveryValue() - security.declareProtected(Permissions.ModifyPortalContent, 'updateSimulationDeliveryProperties') + security.declareProtected(Permissions.ModifyPortalContent, + 'updateSimulationDeliveryProperties') def updateSimulationDeliveryProperties(self, movement_list = None): """ - Set properties delivery_ratio and delivery_error for each simulation movement - in movement_list (all movements by default), according to this delivery calculated quantity + Set properties delivery_ratio and delivery_error for each + simulation movement in movement_list (all movements by default), + according to this delivery calculated quantity """ - parent = self.getParent() + parent = self.getParentValue() if parent is not None: parent.updateSimulationDeliveryProperties(movement_list, self) diff --git a/product/ERP5/Document/ImmobilisableItem.py b/product/ERP5/Document/ImmobilisableItem.py index 97290bf48fe76d1061064704032b1605d8d315f5..5787d973070e7a465cab6bf506ca3a2db7a3ff41 100644 --- a/product/ERP5/Document/ImmobilisableItem.py +++ b/product/ERP5/Document/ImmobilisableItem.py @@ -214,7 +214,7 @@ class ImmobilisableItem(XMLObject, Amount): organisation.getFinancialYearStopDate() is None: if category is None: return None if category.getPortalType() != "Base Category": - return self._getFirstIndependantOrganisation(category.getParent()) + return self._getFirstIndependantOrganisation(category.getParentValue()) else: return None return organisation diff --git a/product/ERP5/Document/InvoiceTransactionRule.py b/product/ERP5/Document/InvoiceTransactionRule.py index 3b1b89aaacaa99253f3fbcb0a272cff45ea9a544..1b0001045bd8e917eafa5d136eaa03fdb34f81cd 100644 --- a/product/ERP5/Document/InvoiceTransactionRule.py +++ b/product/ERP5/Document/InvoiceTransactionRule.py @@ -137,7 +137,7 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): resource = invoice.getPriceCurrency() if resource is None : # search the resource on parents simulation movement's deliveries - simulation_movement = applied_rule.getParent() + simulation_movement = applied_rule.getParentValue() portal_simulation = self.getPortalObject().portal_simulation while resource is None and \ simulation_movement != portal_simulation : @@ -145,7 +145,7 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): if hasattr(delivery, 'getPriceCurrency') and \ delivery.getPriceCurrency() is not None : resource = delivery.getPriceCurrency() - if simulation_movement.getParent().getParent() \ + if simulation_movement.getParentValue().getParentValue() \ == portal_simulation : # we are on the first simulation movement, we'll try # to get the resource from it's order price currency. @@ -154,7 +154,7 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): order.getPriceCurrency() is not None : resource = order.getPriceCurrency() simulation_movement = simulation_movement\ - .getParent().getParent() + .getParentValue().getParentValue() if resource is None : # last resort : get the resource from the rule diff --git a/product/ERP5/Document/InvoicingRule.py b/product/ERP5/Document/InvoicingRule.py index d766266371e78705ac334ad8af2733231313ec0e..43756daeeec0e9168bac1b11afdf3bf2cf9a3187 100644 --- a/product/ERP5/Document/InvoicingRule.py +++ b/product/ERP5/Document/InvoicingRule.py @@ -64,7 +64,7 @@ class InvoicingRule(Rule): """ Tests if the rule (still) applies """ - parent = movement.getParent() + parent = movement.getParentValue() result = 0 if (parent.getPortalType() == 'Applied Rule') and \ (parent.getSpecialiseId() in ('default_order_rule', @@ -78,9 +78,10 @@ class InvoicingRule(Rule): """ delivery_line_type = 'Simulation Movement' # Source that movement from the next node / stock - my_context_movement = applied_rule.getParent() + my_context_movement = applied_rule.getParentValue() - # Do not invoice within the same entity or whenever entities are not all defined + # Do not invoice within the same entity or whenever entities are + # not all defined # It is OK to invoice within different entities of the same company # if we wish to get some internal analytical accounting # but that requires some processing to produce a balance sheet diff --git a/product/ERP5/Document/PaymentRule.py b/product/ERP5/Document/PaymentRule.py index ae82952c9138c36eb5755a372e1d91ef924b7a5f..4b216715e01d0d78ded9871c5e0ed8179834be21 100644 --- a/product/ERP5/Document/PaymentRule.py +++ b/product/ERP5/Document/PaymentRule.py @@ -67,7 +67,7 @@ class PaymentRule(Rule): Tests if the rule (still) applies """ if 'receivable' in movement.getId() : ### TODO: expand 'payable' too - parent = movement.getParent() + parent = movement.getParentValue() if parent.getPortalType()=='Applied Rule' \ and parent.getSpecialiseId()=='default_invoice_transaction_rule': #LOG('PaymentRule.test :', 0, repr(( 'applies with', movement, parent ))) @@ -86,7 +86,7 @@ class PaymentRule(Rule): """ payment_line_type = 'Simulation Movement' - my_parent_movement = applied_rule.getParent() + my_parent_movement = applied_rule.getParentValue() if my_parent_movement.getQuantity() is not None: bank_id = 'bank' diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index 21bd1edb951ba023888fda48f810eab4f6f077fd..cfcc3c9ad4057843cba58e2885d47efdefe3e518 100644 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -222,7 +222,7 @@ class SimulationMovement(Movement): # we know that invoicing rule acts like this, and that it comes after # invoice or invoicing_rule, so we if we come from invoince rule or # invoicing rule, we always expand regardless of the causality state. - if ((self.getParent().getSpecialiseId() not in + if ((self.getParentValue().getSpecialiseId() not in ('default_invoicing_rule', 'default_invoice_rule') and self.getCausalityState() == 'expanded' ) or \ len(self.objectIds()) != 0): @@ -336,7 +336,7 @@ class SimulationMovement(Movement): while explanation_value.getPortalType() not in \ self.getPortalDeliveryTypeList() and \ explanation_value != self.getPortalObject(): - explanation_value = explanation_value.getParent() + explanation_value = explanation_value.getParentValue() if explanation_value != self.getPortalObject(): return explanation_value @@ -523,7 +523,7 @@ class SimulationMovement(Movement): Return the root simulation movement in the simulation tree. FIXME : this method should be called getRootSimulationMovementValue """ - parent_applied_rule = self.getParent() + parent_applied_rule = self.getParentValue() if parent_applied_rule.getRootAppliedRule() == parent_applied_rule: return self else: diff --git a/product/ERP5/Document/SupplyLink.py b/product/ERP5/Document/SupplyLink.py index c6ee6e0411405ea3234fe94c843afcf6113bd1aa..ee942904001535754834b4f23268f07936f46255 100644 --- a/product/ERP5/Document/SupplyLink.py +++ b/product/ERP5/Document/SupplyLink.py @@ -122,7 +122,7 @@ class SupplyLink(Path, XMLObject): ind_phase_list = movement.getIndustrialPhaseValueList() if ind_phase_list != []: # Is this SupplyLink in the route to the previous production node ? - supply_chain = self.getParent() + supply_chain = self.getParentValue() previous_ind_phase_list =\ supply_chain.getPreviousProductionIndustrialPhaseList(self) for ind_phase in ind_phase_list: @@ -139,24 +139,24 @@ class SupplyLink(Path, XMLObject): else: # Check if raw material is create by a production link or a packing # list link. - supply_chain = self.getParent() + supply_chain = self.getParentValue() next_industrial_phase_list = \ supply_chain.getNextProductionIndustrialPhaseList(self) ind_phase_id_list = [x.getId() for x in next_industrial_phase_list] # Get the transformation to use - applied_rule = movement.getParent() + applied_rule = movement.getParentValue() rule = applied_rule.getSpecialiseValue() transformation = rule.getTransformation(movement) # Call getAggregatedAmountList amount_list = transformation.getAggregatedAmountList( - movement.getParent().getParent(), + movement.getParentValue().getParentValue(), ind_phase_id_list=ind_phase_id_list) resource_list = [x.getResourceValue() for x in amount_list] current_resource = movement.getResourceValue() if current_resource not in resource_list: # We can delivered this resource - supply_chain = self.getParent() + supply_chain = self.getParentValue() previous_ind_phase_list =\ supply_chain.getPreviousProductionIndustrialPhaseList(self) if len(previous_ind_phase_list) == 0: diff --git a/product/ERP5/Document/TransformationRule.py b/product/ERP5/Document/TransformationRule.py index 83f1262698e69ec3a5cd79935346eae64f8616c8..dc884c5d2ecbd3521916b4cb89104d823447f635 100644 --- a/product/ERP5/Document/TransformationRule.py +++ b/product/ERP5/Document/TransformationRule.py @@ -84,7 +84,7 @@ class TransformationRule(Rule): # We only produced what is asked on the Production Order result = 0 else: - supply_chain = self.getSupplyChain(movement.getParent()) + supply_chain = self.getSupplyChain(movement.getParentValue()) parent_supply_link = self.getCurrentSupplyLink(movement) current_tranfo_link_list = supply_chain.\ getPreviousProductionSupplyLinkList(parent_supply_link) @@ -107,13 +107,13 @@ class TransformationRule(Rule): An applied rule can be expanded only if its parent movement is expanded. """ - parent_movement = applied_rule.getParent() + parent_movement = applied_rule.getParentValue() # Get production node and production section production = parent_movement.getSource() production_section = parent_movement.getSourceSection() # Get the current supply link used to calculate consumed resource # The current supply link is calculated from the parent AppliedRule. - supply_chain = self.getSupplyChain(parent_movement.getParent()) + supply_chain = self.getSupplyChain(parent_movement.getParentValue()) parent_supply_link = self.getCurrentSupplyLink(parent_movement) current_supply_link_list = supply_chain.\ getPreviousProductionSupplyLinkList(parent_supply_link) @@ -126,12 +126,12 @@ class TransformationRule(Rule): else: current_supply_link = current_supply_link_list[0] # Generate produced movement - movement_dict = self._expandProducedResource(applied_rule, + movement_dict = self._expandProducedResource(applied_rule, production, production_section, current_supply_link) # Generate consumed movement - consumed_mvt_dict = self._expandConsumedResource(applied_rule, + consumed_mvt_dict = self._expandConsumedResource(applied_rule, production, production_section, current_supply_link) @@ -148,7 +148,7 @@ class TransformationRule(Rule): Create a movement for the resource produced by the transformation. Only one produced movement can be created. """ - parent_movement = applied_rule.getParent() + parent_movement = applied_rule.getParentValue() stop_date = parent_movement.getStartDate() produced_movement_dict = { 'pr': { @@ -183,8 +183,8 @@ class TransformationRule(Rule): # Store each value in a dictionnary before created them. # { movement_id: {property_name: property_value,} ,} consumed_movement_dict = {} - parent_movement = applied_rule.getParent() - supply_chain = self.getSupplyChain(parent_movement.getParent()) + parent_movement = applied_rule.getParentValue() + supply_chain = self.getSupplyChain(parent_movement.getParentValue()) # Consumed previous variation previous_variation_dict = self._expandConsumedPreviousVariation( applied_rule, @@ -211,7 +211,7 @@ class TransformationRule(Rule): """ id_count = 1 consumed_movement_dict = {} - parent_movement = applied_rule.getParent() + parent_movement = applied_rule.getParentValue() # Calculate the variation category list of parent movement base_category_list = parent_movement.getVariationBaseCategoryList() if "industrial_phase" in base_category_list: @@ -257,7 +257,7 @@ class TransformationRule(Rule): """ Create a movement for each resource consumed by the transformation, """ - parent_movement = applied_rule.getParent() + parent_movement = applied_rule.getParentValue() # Calculate the context for getAggregatedAmountList base_category_list = parent_movement.getVariationBaseCategoryList() if "industrial_phase" in base_category_list: diff --git a/product/ERP5/Document/TransformationSourcingRule.py b/product/ERP5/Document/TransformationSourcingRule.py index 7c77d8963a9fe51d6874ec71b8d7dab1913dfbfb..a6fafc98c410e49a3502d20d8ea4d32eab7d4f7f 100644 --- a/product/ERP5/Document/TransformationSourcingRule.py +++ b/product/ERP5/Document/TransformationSourcingRule.py @@ -104,12 +104,12 @@ class TransformationSourcingRuleMixin(ExtensionClass.Base): production_order_movement = movement.getRootSimulationMovement().\ getOrderValue() # XXX Acquisition can be use instead - parent_uid = production_order_movement.getParent().getUid() + parent_uid = production_order_movement.getParentUid() explanation_uid = production_order_movement.getExplanationUid() if parent_uid == explanation_uid: production_order_line = production_order_movement else: - production_order_line = production_order_movement.getParent() + production_order_line = production_order_movement.getParentValue() script = production_order_line._getTypeBasedMethod('_getTransformation') if script is not None: transformation = script() @@ -165,7 +165,7 @@ class TransformationSourcingRule(Rule): (movement.getSourceValue() is None): result = 0 else: - supply_chain = self.getSupplyChain(movement.getParent()) + supply_chain = self.getSupplyChain(movement.getParentValue()) parent_supply_link = self.getCurrentSupplyLink(movement) if not supply_chain.test(parent_supply_link, movement): result = 0 @@ -191,9 +191,9 @@ class TransformationSourcingRule(Rule): An applied rule can be expanded only if its parent movement is expanded. """ - parent_movement = applied_rule.getParent() + parent_movement = applied_rule.getParentValue() # Calculate the previous supply link - supply_chain = self.getSupplyChain(parent_movement.getParent()) + supply_chain = self.getSupplyChain(parent_movement.getParentValue()) parent_supply_link = self.getCurrentSupplyLink(parent_movement) previous_supply_link_list = supply_chain.\ getPreviousPackingListSupplyLinkList( diff --git a/product/ERP5/MovementGroup.py b/product/ERP5/MovementGroup.py index ad658c3fb5c9ac1ba0123d8d075944dc5833c481..e32287926c23dba3a77410b172ee3fcfeadda101 100644 --- a/product/ERP5/MovementGroup.py +++ b/product/ERP5/MovementGroup.py @@ -279,12 +279,12 @@ class CausalityMovementGroup(RootMovementGroup): def _getExplanationRelativeUrl(self, movement): """ Get the order value for a movement """ - if hasattr(movement, 'getParent'): + if hasattr(movement, 'getParentValue'): # This is a simulation movement - if movement.getParent() != movement.getRootAppliedRule() : + if movement.getParentValue() != movement.getRootAppliedRule() : # get the explanation of parent movement if we have not been # created by the root applied rule. - movement = movement.getParent().getParent() + movement = movement.getParentValue().getParentValue() explanation_value = movement.getExplanationValue() if explanation_value is None: raise ValueError, 'No explanation for movement %s' % movement.getPath() @@ -1024,7 +1024,7 @@ class TransformationAppliedRuleCausalityMovementGroup(RootMovementGroup): def _getExplanationRelativeUrl(self, movement): """ Get the order value for a movement """ - transformation_applied_rule = movement.getParent() + transformation_applied_rule = movement.getParentValue() transformation_rule = transformation_applied_rule.getSpecialiseValue() if transformation_rule.getPortalType() != 'Transformation Rule': raise MovementGroupError, 'movement! %s' % movement.getPath() diff --git a/product/ERP5/TargetSolver/CopyToTarget.py b/product/ERP5/TargetSolver/CopyToTarget.py index 1f1e5af11f68d1a283845cad62d30015e868379d..2f377a2fdc6cb7707da3f831fb1a9142aae6a1b7 100644 --- a/product/ERP5/TargetSolver/CopyToTarget.py +++ b/product/ERP5/TargetSolver/CopyToTarget.py @@ -93,8 +93,8 @@ class CopyToTarget(TargetSolver): """ Get parent movement, and its value delta dict. """ - applied_rule = movement.getParent() - parent_movement = applied_rule.getParent() + applied_rule = movement.getParentValue() + parent_movement = applied_rule.getParentValue() if parent_movement.getPortalType() != "Simulation Movement": parent_movement = None return parent_movement, value_delta_dict diff --git a/product/ERP5/TargetSolver/TransformationSourcingCopyToTarget.py b/product/ERP5/TargetSolver/TransformationSourcingCopyToTarget.py index 811727e5e492bbb288da002b3324b004ba16ec64..acf51c8eb49bc9debd853b9a96be3f3e471def9e 100644 --- a/product/ERP5/TargetSolver/TransformationSourcingCopyToTarget.py +++ b/product/ERP5/TargetSolver/TransformationSourcingCopyToTarget.py @@ -60,7 +60,7 @@ class TransformationSourcingCopyToTarget(CopyToTarget): """ Get parent movement, and its value delta dict. """ - applied_rule = movement.getParent() + applied_rule = movement.getParentValue() rule = applied_rule.getSpecialiseValue() if rule.getPortalType() != "Transformation Sourcing Rule": value_delta_dict.pop('aggregate_list', None) diff --git a/product/ERP5/tests/testAccountingRules.py b/product/ERP5/tests/testAccountingRules.py index 9a36fe0d7a372e7fd475b81ffc76461d90ef9e77..5192091a60ae4b771ec7594429c400f118c6e612 100644 --- a/product/ERP5/tests/testAccountingRules.py +++ b/product/ERP5/tests/testAccountingRules.py @@ -773,7 +773,7 @@ class TestAccountingRules(TestAccountingRulesMixin,ERP5TypeTestCase): # getTotalPrice uses mysql, so we must make sure the invoice is cataloged # to have correct results - invoice_line.getParent().recursiveImmediateReindexObject() + invoice_line.getParentValue().recursiveImmediateReindexObject() self.assertEqual(invoice_line.getTotalPrice(), 100) self.assertEqual(invoice_line.getTotalQuantity(), 10) diff --git a/product/ERP5Type/Document/Folder.py b/product/ERP5Type/Document/Folder.py index 77c92b85e05681b88f7d823948cf18dbaf974fec..6864bf726f541eb4cd0496649885aa9d13b0778b 100644 --- a/product/ERP5Type/Document/Folder.py +++ b/product/ERP5Type/Document/Folder.py @@ -719,7 +719,7 @@ be a problem).""" object.immediateReindexObject() if delete: if len(from_object.portal_categories.getRelatedValueList(from_object))==0: - parent = from_object.getParent() + parent = from_object.getParentValue() parent.manage_delObjects(from_object.getId()) return corrected_list