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)
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 try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 6/30/15, 4:17 AM|
|Seen: 567 times|
|Last updated: 6/30/15, 4:24 AM|