Skip to content

Using pyodata with old MS CRM 2015 #95

Open
@bip91

Description

@bip91

Hi,

Thank you for this wonderfull piece of code.
pyodata can also be used successfully with MS CRM 2015 with 2 minors changes :

  • the first one is to change PATCH method by MERGE Method in service.py (MS CRM 365 is now using PATCH)
  • the second one is a small try/catch in EdmStructTypeSerializer.from_json to avoid some None result
    that raise an exception (At the end of this report)

Is there a way to integrate these changes in a vendor specific python file as it exists for SAP ?

Change made in def from_json(edm_type, value):

            if type_prop.name in value:
>               try:
                   result[type_prop.name] = type_prop.typ.traits.from_json(value[type_prop.name])
>               except (TypeError, AttributeError):
>                  modlog().warning(value)
        return result

This catchs the following errors in MS CRM 2015 to trap None 'Value' :

WARNING:pyodata.model:{'__metadata': {'type': 'Microsoft.Crm.Sdk.Data.Services.EntityReference'}, 'Id': 'f3d1cca6-0313-e711-80be-005056011e04', 'LogicalName': 'systemuser', 'Name': None} WARNING:pyodata.model:{'__metadata': {'type': 'Microsoft.Crm.Sdk.Data.Services.EntityReference'}, 'Id': None, 'LogicalName': None, 'Name': None} WARNING:pyodata.model:{'__metadata': {'type': 'Microsoft.Crm.Sdk.Data.Services.OptionSetValue'}, 'Value': None}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions