def _get_default_image(self, partner_type, is_company, parent_id): if getattr(threading.currentThread(), 'testing', False) or self._context.get('install_mode'): return False colorize, img_path, image = False, False, False if partner_type in ['other'] and parent_id: parent_image = self.browse(parent_id).image image = parent_image and base64.b64decode(parent_image) or None if not image and partner_type == 'invoice': img_path = get_module_resource('base', 'static/src/img', 'money.png') elif not image and partner_type == 'delivery': img_path = get_module_resource('base', 'static/src/img', 'truck.png') elif not image and is_company: img_path = get_module_resource('base', 'static/src/img', 'company_image.png') elif not image: img_path = get_module_resource('base', 'static/src/img', 'avatar.png') colorize = True if img_path: with open(img_path, 'rb') as f: image = f.read() if image and colorize: image = tools.image_colorize(image) return tools.image_resize_image_big(base64.b64encode(image))
def _set_image_value(self, value): if isinstance(value, pycompat.text_type): value = value.encode('ascii') image = tools.image_resize_image_big(value) if self.product_tmpl_id.image: self.image_variant = image else: self.product_tmpl_id.image = image
def _default_image(self): image_path = get_module_resource('hr', 'static/src/img', 'default_image.png') return tools.image_resize_image_big( base64.b64encode(open(image_path, 'rb').read()))
def _get_default_image(self): image_path = modules.get_module_resource('mail', 'static/src/img', 'groupdefault.png') return tools.image_resize_image_big( base64.b64encode(open(image_path, 'rb').read()))