Commit d4e96b43 authored by Jérome Perrin's avatar Jérome Perrin

Stop using getParent deprecated accessor

parent 61dd90e0
Pipeline #14732 failed with stage
in 0 seconds
org=context.restrictedTraverse(context.REQUEST.organisation) org=context.restrictedTraverse(context.REQUEST.organisation)
adr=org.getAddress() adr=org.getAddress()
woj=adr.getRegionValue() woj=adr.getRegionValue()
kraj=woj.getParent() kraj=woj.getParentValue()
return woj.getTitle(),kraj.getTitle() return woj.getTitle(),kraj.getTitle()
...@@ -2,7 +2,7 @@ cell_range = [] ...@@ -2,7 +2,7 @@ cell_range = []
# Those value are define on property sheet of portal type # Those value are define on property sheet of portal type
resource = context.getDefaultResourceValue() resource = context.getDefaultResourceValue()
if resource is None: # When we have a supply line in the resource if resource is None: # When we have a supply line in the resource
resource = context.getParent() resource = context.getParentValue()
base_category_list = resource.getVariationBaseCategoryList() base_category_list = resource.getVariationBaseCategoryList()
......
...@@ -7,7 +7,7 @@ default_available_language = kw.get('default_available_language', 'en') ...@@ -7,7 +7,7 @@ default_available_language = kw.get('default_available_language', 'en')
context.setGlobalConfigurationAttr(default_available_language=default_available_language) context.setGlobalConfigurationAttr(default_available_language=default_available_language)
configuration_save = context.restrictedTraverse(configuration_save_url) configuration_save = context.restrictedTraverse(configuration_save_url)
business_configuration = configuration_save.getParent() business_configuration = configuration_save.getParentValue()
# if preferred email is not specified used previously saved company email. # if preferred email is not specified used previously saved company email.
company_email = context.getGlobalConfigurationAttr('company_email') company_email = context.getGlobalConfigurationAttr('company_email')
......
...@@ -19,7 +19,7 @@ if item_portal_type[0] is not None: ...@@ -19,7 +19,7 @@ if item_portal_type[0] is not None:
while context_obj is not None \ while context_obj is not None \
and hasattr(context_obj, 'getPortalType') \ and hasattr(context_obj, 'getPortalType') \
and context_obj.getPortalType() != item_portal_type[1]: and context_obj.getPortalType() != item_portal_type[1]:
context_obj = context_obj.getParent() context_obj = context_obj.getParentValue()
if context_obj is not None \ if context_obj is not None \
and hasattr(context_obj, 'getPortalType') \ and hasattr(context_obj, 'getPortalType') \
and context_obj.getPortalType() == item_portal_type[1]: and context_obj.getPortalType() == item_portal_type[1]:
......
...@@ -127,7 +127,7 @@ class ERP5PaymentTransactionConduit(TioSafeBaseConduit): ...@@ -127,7 +127,7 @@ class ERP5PaymentTransactionConduit(TioSafeBaseConduit):
sub_object.setPriceCurrencyValue(link_object) sub_object.setPriceCurrencyValue(link_object)
bank_account_object = integration_site.getDefaultSourcePaymentValue() bank_account_object = integration_site.getDefaultSourcePaymentValue()
sub_object.setDefaultSourcePaymentValue(bank_account_object) sub_object.setDefaultSourcePaymentValue(bank_account_object)
sub_object.setSourceSectionValue(bank_account_object.getParent()) sub_object.setSourceSectionValue(bank_account_object.getParentValue())
# Mapping between tag and element # Mapping between tag and element
node_dict = { node_dict = {
......
...@@ -13,7 +13,7 @@ def getERP5CategoryUrl(category): ...@@ -13,7 +13,7 @@ def getERP5CategoryUrl(category):
if category.getPortalType() == "Base Category": if category.getPortalType() == "Base Category":
return category.getTitle() return category.getTitle()
else: else:
return "%s/%s" % (getERP5CategoryUrl(category.getParent()), category.getTitle()) return "%s/%s" % (getERP5CategoryUrl(category.getParentValue()), category.getTitle())
def isUrlInTupleList(tuple_list, url): def isUrlInTupleList(tuple_list, url):
for (k,v) in tuple_list: for (k,v) in tuple_list:
...@@ -23,14 +23,14 @@ def isUrlInTupleList(tuple_list, url): ...@@ -23,14 +23,14 @@ def isUrlInTupleList(tuple_list, url):
if context.getPortalType() == "Integration Category Mapping": if context.getPortalType() == "Integration Category Mapping":
try: try:
uid = "_".join(context.getParent().getRelativeUrl().split("/")[2:]) uid = "_".join(context.getParentValue().getRelativeUrl().split("/")[2:])
category_url = request.form["field_listbox_destination_reference_new_%s" % uid] category_url = request.form["field_listbox_destination_reference_new_%s" % uid]
except: except:
category_url = context.getParent().getDestinationReference() category_url = context.getParentValue().getDestinationReference()
if category_url is not None and category_url != "": if category_url is not None and category_url != "":
container = context.restrictedTraverse("portal_categories/%s" % category_url) container = context.restrictedTraverse("portal_categories/%s" % category_url)
try: try:
uid = "_".join(context.getParent().getRelativeUrl().split("/")[2:]) uid = "_".join(context.getParentValue().getRelativeUrl().split("/")[2:])
new_destination_reference = request.form["field_listbox_destination_reference_new_%s" % uid] new_destination_reference = request.form["field_listbox_destination_reference_new_%s" % uid]
if new_destination_reference == "": if new_destination_reference == "":
value = request.form["field_listbox_destination_reference_new_%s" % context.getId()] value = request.form["field_listbox_destination_reference_new_%s" % context.getId()]
......
NBSP_UTF8 = u'\xA0'.encode('utf-8') NBSP_UTF8 = u'\xA0'.encode('utf-8')
def getCategoryLevel(category=None): def getCategoryLevel(category=None):
if getattr(category.getParent(), "getDestinationReference", None) is None: if getattr(category.getParentValue(), "getDestinationReference", None) is None:
return 0 return 0
return 1 + getCategoryLevel(category.getParent()) return 1 + getCategoryLevel(category.getParentValue())
level = getCategoryLevel(context.getParent()) level = getCategoryLevel(context.getParentValue())
return "%s%s" % (NBSP_UTF8 * 8 * level, context.getSourceReference()) return "%s%s" % (NBSP_UTF8 * 8 * level, context.getSourceReference())
...@@ -9,7 +9,7 @@ len_line_list = len(line_list) ...@@ -9,7 +9,7 @@ len_line_list = len(line_list)
if len_line_list!=0: if len_line_list!=0:
for line in line_list: for line in line_list:
container = integration_site container = integration_site
parent = line.getParent() parent = line.getParentValue()
if line.getPortalType() == "Integration Category Mapping" and parent is not None: if line.getPortalType() == "Integration Category Mapping" and parent is not None:
container = parent container = parent
obj=container.newContent(portal_type=line.getPortalType(), obj=container.newContent(portal_type=line.getPortalType(),
......
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
def getCategoryUrl(category_mapping=None): def getCategoryUrl(category_mapping=None):
if getattr(category_mapping.getParent(), "getDestinationReference", None) is None: if getattr(category_mapping.getParentValue(), "getDestinationReference", None) is None:
return "portal_categories" return "portal_categories"
return "%s/%s" % (getCategoryUrl(category_mapping.getParent()), category_mapping.getDestinationReference()) return "%s/%s" % (getCategoryUrl(category_mapping.getParentValue()), category_mapping.getDestinationReference())
def createCategory(object_mapping=None, category=""): def createCategory(object_mapping=None, category=""):
if object_mapping is None or category=="": if object_mapping is None or category=="":
return return
category_url = getCategoryUrl(object_mapping.getParent()) category_url = getCategoryUrl(object_mapping.getParentValue())
category_object = context.restrictedTraverse(category_url) category_object = context.restrictedTraverse(category_url)
if category_object is not None: if category_object is not None:
if category_object.getId() == "portal_categories": if category_object.getId() == "portal_categories":
......
...@@ -57,28 +57,28 @@ if len_line_list!=0: ...@@ -57,28 +57,28 @@ if len_line_list!=0:
line_id = your_mapping['listbox_key'] line_id = your_mapping['listbox_key']
request.form["field_listbox_destination_reference_new_%s"%line_id] = your_destination_reference request.form["field_listbox_destination_reference_new_%s"%line_id] = your_destination_reference
request.form["field_listbox_destination_reference_text_new_%s"%line_id] = your_destination_reference_text request.form["field_listbox_destination_reference_text_new_%s"%line_id] = your_destination_reference_text
if line.getParent().getPortalType() in ["Integration Category Mapping", "Integration Base Category Mapping"]: if line.getParentValue().getPortalType() in ["Integration Category Mapping", "Integration Base Category Mapping"]:
uid = "_".join(line.getParent().getRelativeUrl().split("/")[2:]) uid = "_".join(line.getParentValue().getRelativeUrl().split("/")[2:])
parent_mapping = mapping_dict[uid] parent_mapping = mapping_dict[uid]
parent_destination_reference = parent_mapping["destination_reference"] parent_destination_reference = parent_mapping["destination_reference"]
parent_destination_reference_text = parent_mapping["destination_reference_text"] parent_destination_reference_text = parent_mapping["destination_reference_text"]
if parent_destination_reference_text != "": if parent_destination_reference_text != "":
reset_uid_list = reset_uid_list + getMappingChildUid(line.getParent()).split('-') reset_uid_list = reset_uid_list + getMappingChildUid(line.getParentValue()).split('-')
for uid in getMappingChildUid(line.getParent()).split('-'): for uid in getMappingChildUid(line.getParentValue()).split('-'):
request.form["field_listbox_destination_reference_new_%s"%uid] = "" request.form["field_listbox_destination_reference_new_%s"%uid] = ""
kw["field_listbox_destination_reference_new_%s"%uid] = "" kw["field_listbox_destination_reference_new_%s"%uid] = ""
parent_uid = "_".join(line.getParent().getRelativeUrl().split("/")[2:]) parent_uid = "_".join(line.getParentValue().getRelativeUrl().split("/")[2:])
request.form["field_listbox_destination_reference_new_%s" % parent_uid] = "" request.form["field_listbox_destination_reference_new_%s" % parent_uid] = ""
kw["field_listbox_destination_reference_new_%s" % parent_uid] = "" kw["field_listbox_destination_reference_new_%s" % parent_uid] = ""
else: else:
if parent_destination_reference == "": if parent_destination_reference == "":
reset_uid_list = reset_uid_list + getMappingChildUid(line.getParent()).split('-') reset_uid_list = reset_uid_list + getMappingChildUid(line.getParentValue()).split('-')
for uid in getMappingChildUid(line.getParent()).split('-'): for uid in getMappingChildUid(line.getParentValue()).split('-'):
request.form["field_listbox_destination_reference_new_%s"%uid] = "" request.form["field_listbox_destination_reference_new_%s"%uid] = ""
kw["field_listbox_destination_reference_new_%s"%uid] = "" kw["field_listbox_destination_reference_new_%s"%uid] = ""
#elif parent_destination_reference != line.getParent().getDestinationReference() \ #elif parent_destination_reference != line.getParentValue().getDestinationReference() \
#and line.getParent().getDestinationReference() not in [None, ""]: #and line.getParentValue().getDestinationReference() not in [None, ""]:
elif line.getParent().getDestinationReference() not in [None, ""]: elif line.getParentValue().getDestinationReference() not in [None, ""]:
line_uid = "_".join(line.getRelativeUrl().split("/")[2:]) line_uid = "_".join(line.getRelativeUrl().split("/")[2:])
destination_reference = request.form["field_listbox_destination_reference_new_%s"%line_uid] destination_reference = request.form["field_listbox_destination_reference_new_%s"%line_uid]
if destination_reference != "" and not destination_reference.startswith(parent_destination_reference): if destination_reference != "" and not destination_reference.startswith(parent_destination_reference):
...@@ -89,8 +89,8 @@ if len_line_list!=0: ...@@ -89,8 +89,8 @@ if len_line_list!=0:
for uid in getMappingChildUid(line).split('-'): for uid in getMappingChildUid(line).split('-'):
request.form["field_listbox_destination_reference_new_%s"%uid] = "" request.form["field_listbox_destination_reference_new_%s"%uid] = ""
kw["field_listbox_destination_reference_new_%s"%uid] = "" kw["field_listbox_destination_reference_new_%s"%uid] = ""
#elif parent_destination_reference == line.getParent().getDestinationReference() \ #elif parent_destination_reference == line.getParentValue().getDestinationReference() \
#and line.getParent().getDestinationReference() not in [None, ""]: #and line.getParentValue().getDestinationReference() not in [None, ""]:
#line_uid = "_".join(line.getRelativeUrl().split("/")[2:]) #line_uid = "_".join(line.getRelativeUrl().split("/")[2:])
#destination_reference = request.form["field_listbox_destination_reference_new_%s"%line_uid] #destination_reference = request.form["field_listbox_destination_reference_new_%s"%line_uid]
#if destination_reference != "" and not destination_reference.startswith(parent_destination_reference): #if destination_reference != "" and not destination_reference.startswith(parent_destination_reference):
......
...@@ -756,7 +756,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -756,7 +756,7 @@ class TestPackingListMixin(TestOrderMixin):
delivery_value = simulation_movement.getDeliveryValue() delivery_value = simulation_movement.getDeliveryValue()
if delivery_value not in delivery_value_list: if delivery_value not in delivery_value_list:
delivery_value_list.append(delivery_value_list) delivery_value_list.append(delivery_value_list)
# new_packing_list = delivery_value.getParent() # new_packing_list = delivery_value.getParentValue()
# self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid()) # self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid())
self.assertEqual(len(delivery_value_list),len(resource_list)) self.assertEqual(len(delivery_value_list),len(resource_list))
...@@ -784,7 +784,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -784,7 +784,7 @@ class TestPackingListMixin(TestOrderMixin):
delivery_value = simulation_movement.getDeliveryValue() delivery_value = simulation_movement.getDeliveryValue()
if delivery_value not in delivery_value_list: if delivery_value not in delivery_value_list:
delivery_value_list.append(delivery_value_list) delivery_value_list.append(delivery_value_list)
# new_packing_list = delivery_value.getParent() # new_packing_list = delivery_value.getParentValue()
# self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid()) # self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid())
self.assertEqual(len(delivery_value_list),len(resource_list)) self.assertEqual(len(delivery_value_list),len(resource_list))
......
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