Skip to Content
Menu
This question has been flagged
1 Reply
9989 Views

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 24
254
6
Feb 24
11114
2
Jun 24
2130
1
Jun 24
1018
0
Feb 24
458