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