Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4919 มุมมอง

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 ?





อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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






อวตาร
ละทิ้ง
ผู้เขียน

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ม.ค. 19
5174
How can i change SQL Query to ORM แก้ไขแล้ว
4
ต.ค. 18
6700
1
มี.ค. 15
7531
1
พ.ย. 22
5811
1
ต.ค. 21
3362