跳至內容
選單
此問題已被標幟
1 回覆
1805 瀏覽次數

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. 

頭像
捨棄
最佳答案

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

頭像
捨棄

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)

相關帖文 回覆 瀏覽次數 活動
3
8月 25
2636
1
5月 25
2655
1
4月 25
3648
1
4月 25
4504
1
4月 25
1974