Commit 025f21fe authored by Jérome Perrin's avatar Jérome Perrin

replace hasattr by getattr(,, None) is not None in updateCausalityState

Do not hardcode level for LOG



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14099 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0694fc03
...@@ -36,6 +36,7 @@ from Products.ERP5.Document.Movement import Movement ...@@ -36,6 +36,7 @@ from Products.ERP5.Document.Movement import Movement
from Products.ERP5.Document.ImmobilisationDelivery import ImmobilisationDelivery from Products.ERP5.Document.ImmobilisationDelivery import ImmobilisationDelivery
from zLOG import LOG from zLOG import LOG
from zLOG import PROBLEM
class Delivery(XMLObject, ImmobilisationDelivery): class Delivery(XMLObject, ImmobilisationDelivery):
""" """
...@@ -195,12 +196,13 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -195,12 +196,13 @@ class Delivery(XMLObject, ImmobilisationDelivery):
if portal_type is None: if portal_type is None:
portal_type = self.getPortalMovementTypeList() portal_type = self.getPortalMovementTypeList()
movement_list = [] movement_list = []
add_movement = movement_list.append
for m in self.contentValues(filter={'portal_type': portal_type}): for m in self.contentValues(filter={'portal_type': portal_type}):
if m.hasCellContent(): if m.hasCellContent():
for c in m.contentValues(filter={'portal_type': portal_type}): for c in m.contentValues(filter={'portal_type': portal_type}):
movement_list.append(c) add_movement(c)
else: else:
movement_list.append(m) add_movement(m)
return movement_list return movement_list
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -320,7 +322,8 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -320,7 +322,8 @@ class Delivery(XMLObject, ImmobilisationDelivery):
deliver is convergent, and if so it will put the delivery deliver is convergent, and if so it will put the delivery
in a solved state, if not convergent in a diverged state in a solved state, if not convergent in a diverged state
""" """
if hasattr(self,'diverge') and hasattr(self,'converge'): if getattr(self, 'diverge', None) is not None \
and getattr(self, 'converge', None) is not None:
if self.isDivergent(**kw): if self.isDivergent(**kw):
self.diverge() self.diverge()
else: else:
...@@ -645,7 +648,7 @@ class Delivery(XMLObject, ImmobilisationDelivery): ...@@ -645,7 +648,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
# if there are not edited (acquisition) # if there are not edited (acquisition)
my_applied_rule.recursiveReindexObject(activate_kw=activate_kw) my_applied_rule.recursiveReindexObject(activate_kw=activate_kw)
else: else:
LOG("ERP5 Error:", 100, LOG("ERP5", PROBLEM,
"Could not expand applied rule %s for delivery %s" %\ "Could not expand applied rule %s for delivery %s" %\
(applied_rule_id, self.getId())) (applied_rule_id, self.getId()))
self.expandRuleRelatedToMovement( self.expandRuleRelatedToMovement(
......
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