Modification concurrente détectée

j’aissai de créer un « SaleOrder » avec l’api rest et je reçois cette erreur

voici l’erreur rest
{
« status »: -1,
« data »: {
« title »: « Modification concurrente détectée »,
« message »: « L’enregistrement a été mis à jour ou supprimé par une autre transaction : [SaleOrder{id:2}] »
}
}
voici le code de la requête
curl --location --request PUT ‹ http://172.16.0.57:8080/ws/rest/com.axelor.apps.sale.db.SaleOrder ›
–header ‹ Accept: application/json ›
–header ‹ Content-Type: application/json ›
–header ‹ Cookie: JSESSIONID=7B06EB5C4D695C6B1ACDC51A51875EB3 ›
–data-raw ‹ {
« status »: 0,
« data »:
{
« carrierPartner »: null,
« expectedRealisationDate »: null,
« periodicityTypeSelect »: 2,
« mainInvoicingAddressStr »: «  »,
« deliveryCondition »: null,
« deliveryAddress »: null,
« nextInvoicingEndPeriodDate »: null,
« salemanUser »: {
« code »: « admin »,
« fullName »: « Admin »,
« id »: 1,
« $version »: 3
},
« id »: 2,
« opportunity »: null,
« updatedOn »: « 2021-06-01T06:19:17.723Z »,
« companyCostTotal »: « 0.00 »,
« version »: 5,
« attrs »: « {} »,
« isToPrintLineSubTotal »: false,
« externalReference »: null,
« invoicedFirstDate »: null,
« template »: false,
« currentContractPeriodEndDate »: null,
« confirmationDateTime »: « 2021-06-02T06:19:04.745Z »,
« saleOrderSeq »: « 010 »,
« stockLocation »: null,
« advancePaymentList »: [],
« createdByInterco »: false,
« numberOfPeriods »: 1,
« contractPeriodInMonths »: 0,
« createdOn »: « 2021-06-03T06:19:01.483Z »,
« timetableList »: [],
« saleOrderScheduleLineList »: [],
« cancelReasonStr »: null,
« isIspmRequired »: false,
« currency »: {
« code »: « AUD »,
« name »: « Australian Dollar »,
« id »: 8,
« $version »: 0
},
« contactPartner »: null,
« cancelReason »: null,
« deliveryDate »: null,
« totalCostPrice »: « 12.00 »,
« tradingName »: null,
« blockedOnCustCreditExceed »: false,
« subscriptionComment »: null,
« stockMoveList »: [],
« hideDiscount »: false,
« team »: null,
« companyBankDetails »: null,
« statusSelect »: 4,
« standardDelay »: 0,
« importId »: null,
« specificNotes »: «  »,
« manualUnblock »: false,
« internalNote »: null,
« saleOrderLineTaxList »: [],
« orderNumber »: null,
« isNeedingConformityCertificate »: false,
« companyExTaxTotal »: « 16.00 »,
« advanceTotal »: « 0.00 »,
« taxTotal »: « 0.00 »,
« project »: null,
« totalGrossMargin »: « 4.00 »,
« noticePeriodInDays »: 0,
« productionNote »: null,
« hasSubLineDefaultValue »: false,
« freightCarrierMode »: null,
« selected »: false,
« isTacitAgreement »: false,
« inTaxTotal »: « 16.00 »,
« orderBeingEdited »: false,
« updatedBy »: {
« code »: « admin »,
« fullName »: « Admin »,
« id »: 1,
« $version »: 3
},
« markup »: « 33.00 »,
« contractStartDate »: null,
« subscriptionText »: null,
« nextInvoicingDate »: null,
« creationDate »: « 2021-06-03 »,
« mainInvoicingAddress »: null,
« saleOrderLineList »: [
{
« fullName »: « 009-Anger »,
« id »: 2,
« $version »: 2
}
],
« templateUser »: null,
« clientPartner »: {
« fullName »: « T000001 - Sirine TRABELSI »,
« id »: 1,
« $version »: 23
},
« electronicSignature »: null,
« incoterm »: null,
« saleOrderTypeSelect »: 1,
« endOfValidityDate »: null,
« orderDate »: null,
« amountToBeSpreadOverTheTimetable »: « 16.00 »,
« importOrigin »: null,
« nextInvPeriodStartDate »: null,
« description »: null,
« forwarderPartner »: null,
« inAti »: false,
« batchSet »: [],
« priceList »: null,
« duration »: null,
« marginRate »: « 25.00 »,
« printingSettings »: null,
« directOrderLocation »: false,
« company »: {
« code »: « 14651146152465 »,
« name »: « Portainer »,
« id »: 1,
« $version »: 2
},
« deliveryAddressStr »: «  »,
« shipmentDate »: null,
« accountedRevenue »: « 16.00 »,
« nextInvoicingStartPeriodDate »: null,
« paymentCondition »: null,
« paymentMode »: null,
« specificPackage »: null,
« contractEndDate »: null,
« fullName »: « 009-Sirine »,
« exTaxTotal »: « 16.00 »,
« shipmentMode »: null,
« versionNumber »: 1,
« amountInvoiced »: « 0.00 »,
« confirmedByUser »: {
« code »: « admin »,
« fullName »: « Admin »,
« id »: 1,
« $version »: 3
},
« createdBy »: {
« code »: « admin »,
« fullName »: « Admin »,
« id »: 1,
« $version »: 3
},
« deliveryState »: 1,
« interco »: false
}
} ›

Meric pur tt aides

Bonjour , pour un ajout pas d’id de l enregistrement

si je supprime l’id j’obtien:
{
« status »: -1,
« data »: {
« popup »: true,
« title »: « Erreur interne du serveur »,
« message »: « id to load is required for loading »
}
}

J ai le meme soucis sur les adresses quand j essaye de l ajouter . Mais il ne faut pas d id ( car il va être attribué par le ssytee sur l ajout )
Je cherche d ou vient cette erreur et vous informe quand je trouve

Mes tests montrent qu il ne faut pas id pour le put , ce qui est logique . L erreur que vous avez viens d un id que vous essayez d importer et qu i n existe pas ( dans les tables référencées )

Hello I got the sollution I should add X-CSRF-Token from login request to header of request:

curl --location --request PUT 'http://0.0.0.0:8080/ws/rest/com.axelor.apps.sale.db.SaleOrder' \
--header 'Content-Type: application/json' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'X-CSRF-Token: 08ADF829DAB97239FFB4555F8786A2E4' \
--header 'Cookie: JSESSIONID=08ADF829DAB97239FFB4555F8786A2E4' \
--data-raw '{
    "data": 
        {    "clientPartner": {
                "fullName": "T000001 - Sirine TRABELSI",
                "id": 1,
                "$version": 26
            },
                        "company": {
                "code": "14651146152465",
                "name": "Portainer",
                "id": 1,
                "$version": 2
            },
                 "currency": {
                "code": "AUD",
                "name": "Australian Dollar",
                "id": 8,
                "$version": 0
            },
               "saleOrderLineList": [
                {
                    "fullName": "025-Car and bike",
                    "id": 38,
                    "$version": 2
                },
                {
                    "fullName": "025-AJAX",
                    "id": 39,
                    "$version": 2
                }
            ],
            "isToPrintLineSubTotal": false,
            "externalReference": null,
            "invoicedFirstDate": null,
            "template": false,
            "currentContractPeriodEndDate": null,
            "confirmationDateTime": null,
            "saleOrderSeq": "006",
            "stockLocation": null,
            "advancePaymentList": [],
            "createdByInterco": false,
            "numberOfPeriods": 1,
            "contractPeriodInMonths": 0,
            "createdOn": "2021-06-02T14:06:11.525Z",
            "timetableList": [],
            "saleOrderScheduleLineList": [],
            "cancelReasonStr": null,
            "isIspmRequired": false,
            "contactPartner": null,
            "cancelReason": null,
            "deliveryDate": null,
            "totalCostPrice": "0.00",
            "tradingName": null,
            "blockedOnCustCreditExceed": false,
            "subscriptionComment": null,
            "stockMoveList": [],
            "hideDiscount": false,
            "team": null,
            "companyBankDetails": null,
            "statusSelect": 2,
            "standardDelay": 0,
            "importId": null,
            "specificNotes": null,
            "manualUnblock": false,
            "internalNote": null,
            "saleOrderLineTaxList": [],
            "orderNumber": null,
            "isNeedingConformityCertificate": false,
            "companyExTaxTotal": "96.00",
            "advanceTotal": "0.00",
            "taxTotal": "0.00",
            "project": null,
            "totalGrossMargin": "0.00",
            "noticePeriodInDays": 0,
            "productionNote": null,
            "hasSubLineDefaultValue": false,
            "freightCarrierMode": null,
            "selected": false,
            "isTacitAgreement": false,
            "inTaxTotal": "96.00",
            "orderBeingEdited": false,
            "markup": "0.00",
            "contractStartDate": null,
            "subscriptionText": null,
            "nextInvoicingDate": null,
            "creationDate": "2021-06-02",
            "mainInvoicingAddress": null,
            "saleOrderLineList": [],
            "templateUser": null,
            "electronicSignature": null,
            "incoterm": null,
            "saleOrderTypeSelect": 1,
            "endOfValidityDate": null,
            "orderDate": null,
            "amountToBeSpreadOverTheTimetable": "0.00",
            "importOrigin": null,
            "nextInvPeriodStartDate": null,
            "description": null,
            "forwarderPartner": null,
            "inAti": false,
            "batchSet": [],
            "priceList": null,
            "duration": null,
            "marginRate": "0.00",
            "printingSettings": null,
            "directOrderLocation": false,
            "deliveryAddressStr": "",
            "shipmentDate": null,
            "accountedRevenue": "0.00",
            "nextInvoicingStartPeriodDate": null,
            "paymentCondition": null,
            "paymentMode": null,
            "specificPackage": null,
            "contractEndDate": null,
            "fullName": "001-Sirine",
            "exTaxTotal": "0.00",
            "shipmentMode": null,
            "versionNumber": 1,
            "amountInvoiced": "0.00",
            "confirmedByUser": null,
            "deliveryState": 1,
            "interco": false
        }
}'

and this is the responce:

{
    "status": 0,
    "data": [
        {
            "carrierPartner": null,
            "expectedRealisationDate": null,
            "periodicityTypeSelect": 2,
            "mainInvoicingAddressStr": null,
            "deliveryCondition": null,
            "deliveryAddress": null,
            "nextInvoicingEndPeriodDate": null,
            "salemanUser": null,
            "id": 53,
            "opportunity": null,
            "updatedOn": "2021-06-07T07:24:59.522Z",
            "companyCostTotal": "0",
            "version": 1,
            "attrs": null,
            "isToPrintLineSubTotal": false,
            "externalReference": null,
            "invoicedFirstDate": null,
            "template": false,
            "currentContractPeriodEndDate": null,
            "confirmationDateTime": null,
            "saleOrderSeq": "006",
            "stockLocation": null,
            "advancePaymentList": [],
            "createdByInterco": false,
            "numberOfPeriods": 1,
            "contractPeriodInMonths": 0,
            "createdOn": "2021-06-07T07:24:59.515Z",
            "timetableList": [],
            "saleOrderScheduleLineList": [],
            "cancelReasonStr": null,
            "isIspmRequired": false,
            "currency": {
                "code": "AUD",
                "name": "Australian Dollar",
                "id": 8,
                "$version": 0
            },
            "contactPartner": null,
            "cancelReason": null,
            "deliveryDate": null,
            "totalCostPrice": "0",
            "tradingName": null,
            "blockedOnCustCreditExceed": false,
            "subscriptionComment": null,
            "stockMoveList": [],
            "hideDiscount": false,
            "team": null,
            "companyBankDetails": null,
            "statusSelect": 2,
            "standardDelay": 0,
            "importId": null,
            "specificNotes": null,
            "manualUnblock": false,
            "internalNote": null,
            "saleOrderLineTaxList": [],
            "orderNumber": null,
            "isNeedingConformityCertificate": false,
            "companyExTaxTotal": "96.00",
            "advanceTotal": "0.00",
            "taxTotal": "0.00",
            "project": null,
            "totalGrossMargin": "0",
            "noticePeriodInDays": 0,
            "productionNote": null,
            "hasSubLineDefaultValue": false,
            "freightCarrierMode": null,
            "selected": false,
            "isTacitAgreement": false,
            "inTaxTotal": "96.00",
            "orderBeingEdited": false,
            "updatedBy": {
                "code": "admin",
                "fullName": "Admin",
                "id": 1,
                "$version": 3
            },
            "markup": "0",
            "contractStartDate": null,
            "subscriptionText": null,
            "nextInvoicingDate": null,
            "creationDate": "2021-06-02",
            "mainInvoicingAddress": null,
            "saleOrderLineList": [],
            "templateUser": null,
            "clientPartner": {
                "fullName": "T000001 - Sirine",
                "id": 1,
                "$version": 29
            },
            "electronicSignature": null,
            "incoterm": null,
            "saleOrderTypeSelect": 1,
            "endOfValidityDate": null,
            "orderDate": null,
            "amountToBeSpreadOverTheTimetable": "0.00",
            "importOrigin": null,
            "nextInvPeriodStartDate": null,
            "description": null,
            "forwarderPartner": null,
            "inAti": false,
            "batchSet": [],
            "priceList": null,
            "duration": null,
            "marginRate": "0",
            "printingSettings": null,
            "directOrderLocation": false,
            "company": {
                "code": "14651146152465",
                "name": "Portainer",
                "id": 1,
                "$version": 2
            },
            "deliveryAddressStr": "",
            "shipmentDate": null,
            "accountedRevenue": "0",
            "nextInvoicingStartPeriodDate": null,
            "paymentCondition": null,
            "paymentMode": null,
            "specificPackage": null,
            "contractEndDate": null,
            "fullName": "006-Sirine",
            "exTaxTotal": "0.00",
            "shipmentMode": null,
            "versionNumber": 1,
            "amountInvoiced": "0.00",
            "confirmedByUser": null,
            "createdBy": {
                "code": "admin",
                "fullName": "Admin",
                "id": 1,
                "$version": 3
            },
            "deliveryState": 1,
            "interco": false
        }
    ]
}