Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
1110 Weergaven

Hello Odoo Community:

   I have created a custom field under the Gamification.goal model. I'd like execute the following code not for specific user_id A, 

for rec in self:

    rec['x_completeness'] = (1100*rec.completeness/100)

And I'd like to excute the next code solely for specific user_id A 

for rec in self:

    rec['x_completeness'] = (400*rec.completeness/100)

Please give me some suggestions. Thanks a lot!

Avatar
Annuleer
Auteur

I have solved the problem with automated actions
Now I'd like to copy the value x_completeness (field type is Float) to a different custom field x_merit under the Payslip model; how should I write the python coding under automated actions? Many thanks!

Beste antwoord

Hi,

To execute specific code for user_id,A,

Replace ''A"  with the actual id of the specific user 

for rec in self:

    if self.env.user.id == A:

           rec['x_completeness'] = (400*rec.completeness/100)

    else:

           rec['x_completeness'] = (1100*rec.completeness/100)



Hope it helps,

Avatar
Annuleer
Auteur

Thanks a lot. It worked!

Gerelateerde posts Antwoorden Weergaven Activiteit
0
feb. 25
1256
0
jan. 25
1096
1
dec. 24
1385
1
jun. 22
5528
1
feb. 19
4929