Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4883 Lượt xem

i want to Clone same model from other for Example 


Model A and Model B 
model A = user_attendance

model B = user_attendance_clone  

i have multi pal record on user_attendance ...

for example i hav 100 record on user_attendance and user_attendance_clone already update 100
50 come more in user_attendance then my schedule will run and update record on user_attendance_clone and do complete 150

first is how i can get RowID via ORM method ? 

how i know which record to need create ?





Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can add in your model A a boolean field which can help you to know if the record is clone or no 

eg. is_cloned = fields.Boolean(help="This record is cloned")

Then in your schedule,

1. You search all model A records whose is_cloned field is False

2. For each found model A records, You perform the clone

3. Then you update his field is_cloned to True value






Ảnh đại diện
Huỷ bỏ
Tác giả

good idea thank @Frejus Arnaud AKA let me implement if its fast then i will approve your answer thanks again

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 19
5130
4
thg 10 18
6671
1
thg 3 15
7497
1
thg 11 22
5681
1
thg 10 21
3314