コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
6444 ビュー

How to update create_uid field using ORM objects

we can do using sql query , i need without using query.

I have tried

browse_obj.write({'create_uid': my_custom_id})  --> not working

browse_obj.create_uid = my_custom_uid    --> not working

アバター
破棄

What's the need to update the created user

著作者

we have multi-level approvals

Ex: Invoice having 2 level approvals

level 1 --> User1

level 2 --> User2

While doing level2 Journal Entry will create with create_uid=User2 here i want to show User1 against the user2

最善の回答

Hi,

For this, you need to change the user of the environment at the time of the creation of the record.

Eg: 
self.env['your.model'].with_env(self.env(user=needed_user_id)).create(your_data)
here for changing the user, i use this code -> with_env(self.env(user=needed_user_id))
​​I don't know, it is the right way or it has some bad effects.​
Expecting advice on this from all the forum members who have an idea about this.



​Thanks & Regards


Avinash N K

LinkedIn : https://in.linkedin.com/in/avinash-nk



アバター
破棄
関連投稿 返信 ビュー 活動
0
9月 23
2045
0
9月 23
1758
2
6月 25
11274
6
10月 23
22120
3
3月 24
9549