Skip to Content
Menu
This question has been flagged
2 Replies
1548 Views

Hi 


I want to import a list of won opportunities coming from salesforce in Odoo V14. 

I can set a date for "Expected Closing", but I can't set a date for "Closed Date" because this is a Odoo base field. 

Is there a suggested workflow to update this field "Closed Date" through an automation? 


Thanks.


Jan

Avatar
Discard
Best Answer

Hello Jan Van Looy,

To update the closed date of won opportunities you can create the server actions as below example.

for rec in records.filtered(lambda lead: lead.stage_id.is_won):
rec['date_closed'] = datetime.datetime.now()

Hope it will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard
Author Best Answer

Hi Jainesh

Thanks for your answer. 

The following screenshot shows the automated action I'm trying to activate on update of imported records:

image0

But the error I get is:

ValueError: : "time data 'x_studio_salesforce_import_date_time' does not match format '%Y-%m-%d %H:%M:%S'" while evaluating
"record.write({'date_closed':'x_studio_salesforce_import_date_time'})"

Both fields "date_closed" and "x_studio_salesforce_import_date_time" are date&time fields, so the error seems illogical. 

I want to match the closed date with the x_studio_salesforce_import_date_time date, but no luck so far.

Do you have any suggestions? 

Thanks

Jan

Avatar
Discard