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

I want to make the creator of the contact as salesperson automatically as they normally forgot to add. It is required field now but normally the creator just choose any user id. 

Avatar
Annuleer
Beste antwoord

Hi Aklili Lamudok,


For this, you can add code like this in create method of 'Contact' model.

Please find code in comment. 

Feel free to contact us for further assistance

Hope this answer helps you.

Thanks & Regards,
Email: odoo@aktivsoftware.com     

Skype: kalpeshmaheshwari

Avatar
Annuleer

Please find code example here :-

EX:

class ResPartner(models.Model):
_inherit = 'res.partner'

@api.model
def create(self, values):
# If the user_id is not provided, set it to the creator's user_id
if 'user_id' not in values:
values['user_id'] = self.env.uid

return super(ResPartner, self).create(values)

Gerelateerde posts Antwoorden Weergaven Activiteit
3
aug. 25
2629
1
mei 25
2652
1
apr. 25
3637
1
apr. 25
4499
1
apr. 25
1966