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

I've noticed that product template now uses image.mixin, however this is an abstract model and i'm unsure as to where abstract models are stored within the database.

I'm trying to move products from 12 - 13

頭像
捨棄
最佳答案

V13 architecture has been changed and we have now a new Image field. In previous versions, if binary fields have an image we used widget="image" and web client respect it and binary data stored on those fields.

ref: https://github.com/odoo/odoo/blob/13.0/odoo/fields.py#L1972

Image field inherit the Binary field and stored the data in ir.attachment 
when we declare image field on the model it will not store data on their current model but it's stored datas in ir.attachments 

so when you inherit any model with image mixin it defines the various size of image fields and you can access it in the current model.
when you perform any CRUD option on those filed it will indirectly perform the same operation on its own record in ir.attachment. 
ORM will find a correct record in ir.attachement using res_model, res_field, res_id

that's the reason we can use image.mixin as an abstract model. it's just a mediator to make available fields on current model but actually data stored in ir.attachement. database column will not create for those fields.

https://github.com/odoo/odoo/commit/8206b5b4cc92b6befd98ebec7f7ef8af588a9b68
https://github.com/odoo/odoo/commit/1e9772889ba6969961aab0e87fd018494d6b15bb

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
8月 24
1145
6
2月 24
12466
1
7月 25
2438
0
6月 25
2592
1
7月 25
1861