Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/30/15, 4:17 AM|
|Seen: 644 times|
|Last updated: 6/30/15, 4:24 AM|