تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2577 أدوات العرض

Hi,


I would need to create an automated action which would allow user to batch update sale order delivery dates. I already thought I got this covered, but run in to issue.


Imagine we have the following sale order data:

S00001, delivery date 1.5.2023

S00002, delivery date 1.6.2023

S00003, delivery date 1.7.2023


User should be able to select the orders and run automated action that would add seven days to each delivery date, so that the delivery dates would be 8.5.2023, 8.6.2023 and 8.7.2023 correspondingly.

I had an automated action created in the developer mode with the following python code: record.commitment_date+datetime.timedelta(days=7)


However, the result with this code is as follows:

S00001, dd 8.5.2023

S00002, dd 15.5.2023

S00003, dd 22.5.2023


How should I update the the python code on the automated action so that it would base the date calculation on each field with the original commitment_date on each sale order, not the previous updated commitment_date on the previous sale order? Thank you for any help!

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Nevermind, I already figured it out, and it was really simple.

Folowing python code does the trick:

for record in records:
record['commitment_date'] = record.commitment_date+datetime.timedelta(days=7)

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
سبتمبر 24
1420
0
مايو 24
26
1
أبريل 24
4849
0
مارس 24
1725
0
مارس 24
1736