Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4795 Visualizzazioni

Hello everyone. I am trying to copy the Confirmation Date of a SO to each line. I created the date field but I am not able to tell Odoo to fetch this date. I cant find any tutorials that address this problem. This is my last attempt code:

for record in self:

  record[("x_studio_fecha_de_entrega")] = sale.order.confirmation_date.date() 

This is the error:

ValueError: <class 'NameError'>: "name 'sale' is not defined" while evaluating
'for record in self:\n  record[("x_studio_fecha_de_entrega")] = sale.order.confirmation_date.date()'

Any help would be appreciated.

Best regards.

Avatar
Abbandona
Risposta migliore

Assuming that self is a recordset of sale.order.line you could do it like this:

for record in self:
    record.x_studio_fecha_de_entrega = record.order_id.confirmation_date

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mar 24
1553
0
mag 20
1891
1
lug 25
1206
2
mar 25
1486
0
feb 25
1129