Skip to Content
Menu
This question has been flagged

Hello all,

Still a mystery here!

In the file : odoo-8.0-20150615/openerp/addons/product/product.py

Columns for the model product.product are defined with these fields :

        [...]

            'image': fields.binary("Variant Image",

                    help="This field holds the image used as image for the product variant, limited to 1024x1024px."),

                    'image_small': fields.function(_get_image_variant, fnct_inv=_set_image_variant,

                    string="Small-sized image", type="binary",

                    help="Image of the product variant (Small-sized image of product template if false)."),

            'image_medium': fields.function(_get_image_variant, fnct_inv=_set_image_variant,

                    string="Medium-sized image", type="binary",

                    help="Image of the product variant (Medium-sized image of product template if false)."),

    [...]


So, I see that the setter of the function field image_medium is _set_image_variant.

Then I want to log a text from this _set_image_variant method.

 

            def _set_image_variant(self, cr, uid, id, name, value, args, context=None):

                    _logger.error("METHOD :: %s", "product_product._set_image_variant")

                    image = tools.image_resize_image_big(value)

                     [...]

                    return res

.

I can save a new image for a product or a product variant, I NEVER see my log text in the terminal logging. All others log text works correctly in others methods (for exampl _get_image_variant).

It is easy to get the log message for product_product._get_image_variant. The message appears when I display image and when I write a new image and other times.

It doesn't seem to have override anywhere in Odoo for this _set_image_variant method.

I have other example of models that I can't log a message from the setter. It must be something I don't understand...

Please help



Avatar
Discard
Related Posts Replies Views Activity
0
Dec 17
2446
1
Jun 21
8896
0
Sep 19
2614
5
Jan 16
13944
1
Jan 16
8140