Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3 Vastaukset
818 Näkymät

I have created a studio field called "Customer Requested Ship Date" (x_studio_customer_requested_ship_date) on the Packing Slip/Delivery Order (stock.picking model).

Whenever a new Delivery Order is created I would like for the value in the Scheduled Date (scheduled_date) field to automatically be copied into the Customer Requested Ship Date field. (I want the initial value of the Customer Requested Ship Date to be the same as the Scheduled Date.  In the future one or both dates may change, but I want them to start off the same).

Both fields are the Type "datetime"


My thought was to set this up as an automation rule that will execute code, but I would like to know the code to do this.  What I have tried is:

record.['x_studio_customer_requested_ship_date'] = record.['scheduled_date']

but that doesn't seem to work.

Avatar
Hylkää
Tekijä Paras vastaus

Thank you both for your reply.  The automation is working now!

Avatar
Hylkää
Paras vastaus

Hello Daniel, 

You are on the right track using an automation rule with an action to update the field. The issue with your code is the syntax. Here is how you can correct it and make it work properly.

Corrected Code:

You can use the following Python code in your automation rule:

record['x_studio_customer_requested_ship_date'] = record['scheduled_date']

Let me know if it helps :)

Avatar
Hylkää
Paras vastaus

Hi Daniel: The code is probably not working due to a typo. Remove the dot (".") between "record" and "[" on both sides.

Avatar
Hylkää