def ftp_connection_push_image_file(self, ftp, distant_folder_path,
                                       local_folder_path, obj, field):

        # Generate temporary image file
        f_name = self._generate_image_file_name(obj, field)
        if not f_name:
            # No image define
            return False
        local_path = os.path.join(local_folder_path, f_name)
        distant_path = os.path.join(distant_folder_path, f_name)
        image_base64 = getattr(obj, field.name)
        # Resize and save image
        tools.image_resize_image(base64_source=image_base64,
                                 size=(120, 120),
                                 encoding='base64',
                                 filetype='PNG')
        image_data = base64.b64decode(image_base64)
        f = open(local_path, 'wb')
        f.write(image_data)
        f.close()

        # Send File by FTP
        f = open(local_path, 'r')
        ftp.storbinary('STOR ' + distant_path, f)

        # Delete temporary file
        os.remove(local_path)
Example #2
0
    def write(self, cr, uid, ids, vals, context=None):
        if isinstance(ids, (int, long)):
            ids = [ids]

        dir_data = self.pool.get('ir.config_parameter').get_param(
            cr, uid, 'image.link_server')
        folder_save = dir_data.split('/')[-1]
        for data in self.browse(cr, uid, ids, context=context):
            full_path = "%s/%s" % (dir_data, data.product_id.id)
            if vals.get('file_import'):
                file_name = vals.get('file_name', data.file_name)
                if not os.path.exists(dir_data):
                    try:
                        os.mkdir(dir_data)
                    except Exception as e:
                        raise osv.except_osv(
                            _('Wrong Permission!'),
                            _('Please set permission for %s!' % dir_data))
                file_import = vals.get('file_import')
                tmp = file_name.split('.')
                ext = tmp[len(tmp) - 1]
                if ext not in ('jpeg', 'png', 'jpg'):
                    raise osv.except_osv(
                        _('Wrong Type!'),
                        _('Image file must be jpeg, png, jpg!'))
                try:
                    image_small = tools.image_resize_image(file_import,
                                                           size=(400, 400))
                    image_big = tools.image_resize_image(file_import,
                                                         size=(800, 800))
                except Exception as e:
                    raise osv.except_osv(_('Wrong Type!'),
                                         _('Please check image file!'))

                if not os.path.exists(full_path):
                    os.mkdir(full_path)

                print file_name
                file_path = full_path + "/" + str(file_name)
                new_file = open(file_path, mode="w")
                new_file.write(base64.decodestring(image_small))
                new_file.close()
                vals['name'] = folder_save + "/%s/%s" % (data.product_id.id,
                                                         str(file_name))
                file_path_big = full_path + "/zoom_" + str(file_name)
                new_file2 = open(file_path_big, mode="w")
                new_file2.write(base64.decodestring(image_big))
                vals['link_href'] = folder_save + "/%s/zoom_%s" % (
                    data.product_id.id, str(file_name))
                new_file2.close()
        return super(product_product_image, self).write(cr,
                                                        uid,
                                                        ids,
                                                        vals,
                                                        context=context)
Example #3
0
    def _refresh_cache(self, record):
        """
            Refresh the cache of the child field to resize again based on new
            binary value from parent field or totally remove all if parent
            field is not set.

            :params {openerp.models.BaseModel} record:
                current recordset (one) to update value for binary field
        """
        field = record._fields[self.name]
        parent_field = field._attrs.get("resize_based_on")

        _logger.debug('Refreshing Image Cache from the field %s of object '
                      '%s id : %s' % (field.name, record._name, record.id))

        ctx = record.env.context.copy()
        # skip update parent field again in `_compute_write`
        # otherwise we will see infinite loop
        ctx['refresh_image_cache'] = True
        ctx["bin_base64_%s" % field._attrs.get("resize_based_on")] = True

        resized_image = None
        if parent_field:
            original_binary = getattr(record, parent_field)
            size = (field._attrs.get("height"), field._attrs.get("width"))
            resized_image = image_resize_image(original_binary, size)

        record.with_context(**ctx)[field.name] = resized_image
Example #4
0
 def _get_logo_topbar(self, cr, uid, ids, _field_name, _args, context=None):
     result = dict.fromkeys(ids, False)
     for record in self.browse(cr, uid, ids, context=context):
         size = (48, 48)
         result[record.id] = image_resize_image(record.partner_id.image,
                                                size)
     return result
Example #5
0
 def _set_image(self, cr, uid, oid, name, value, args, context=None):
     image_data = tools.image_resize_image(value, (1024, 2024),
                                           filetype="PNG",
                                           avoid_if_small=True,
                                           preserve_aspect_ratio=True)
     return self.write(cr,
                       uid, [oid], {"image": image_data},
                       context=context)
Example #6
0
 def _get_image(self, cr, uid, ids, name, args, context=None):
     result = dict.fromkeys(ids, False)
     for obj in self.browse(cr, uid, ids, context=context):
         image_data = obj.image
         result[obj.id] = {
             "image_80mm":
             tools.image_resize_image(image_data, (576, 576),
                                      avoid_if_small=True,
                                      preserve_aspect_ratio=True),
             "image_58mm":
             tools.image_resize_image(image_data, (384, 384),
                                      avoid_if_small=True,
                                      preserve_aspect_ratio=True),
             "image_format":
             image_data and "png" or None
         }
     return result
Example #7
0
    def _compute_write(self, records):
        """
            Control how a value of ImageField should be updated, when an
            ImageField field is updated should consider the case:

            - current field is parent field or child field:
                the parent field should be always update first, then update
                related child fields.

            :param {openerp.models.BaseModel} records:
                current working recordset
        """
        field_name = self.name

        # for safety - do it for each record in the set
        for record in records:

            # get context on record
            context = record.env.context

            # current ImageField binary value to write
            binary_value = record[field_name]

            # get current field object
            field_object = record._fields[field_name]

            # if current field is child field, get parent field
            parent_field = field_object._attrs.get("resize_based_on")

            # when user updates child field DIRECTLY
            #   > update parent field first
            # when refresh image cache means update child field INDIRECTLY
            #   > skip the update because it will cause infinite loop,
            #     so go to the `else` instead
            if parent_field and not record.env.context.get(
                    "refresh_image_cache"):
                record[parent_field] = binary_value
                return
            else:
                width = field_object._attrs.get("height")
                height = field_object._attrs.get("width")
                if width or height:
                    size = (height or 64, width or 64)
                    binary_value = image_resize_image(binary_value, size)

                # write resized binary image
                self._write_binary(record, field_name, binary_value)

                # refresh child field cached (if has)
                for _name, _field in record._fields.items():

                    # if current field is instance of BinaryField
                    if not isinstance(_field, BinaryField): continue

                    # if current field is child field of binary field
                    if _field._attrs.get("resize_based_on") == field_name:
                        _field._refresh_cache(record)
        return
Example #8
0
 def init(self, cr):
     img = open(
         os.path.join(os.path.dirname(__file__), 'static', 'src', 'img',
                      'logo.png'), 'rb').read().encode('base64')
     cr.execute('UPDATE res_partner SET image=%s WHERE is_company=TRUE',
                (img, ))
     size = (180, None)
     cr.execute('UPDATE res_company SET logo_web=%s',
                (image_resize_image(img, size), ))
Example #9
0
 def _get_logo_web(self, cr, uid, ids, _field_name, _args, context=None):
     result = dict.fromkeys(ids, False)
     for record in self.browse(cr, uid, ids, context=context):
         size = (540, 162)
         result[record.id] = image_resize_image(record.partner_id.image,
                                                size,
                                                avoid_if_small=True,
                                                preserve_aspect_ratio=True)
     return result
Example #10
0
 def _get_image(self):
     """ calculate the images sizes and set the images to the corresponding
         fields
     """
     image = self.photo
     data = tools.image_resize_image(image,
                                     size=(250, 300),
                                     encoding='base64',
                                     filetype=None,
                                     avoid_if_small=False)
     self.photo_medium = data
     return True
Example #11
0
 def _compute_qr_depends(self):
     for student in self:
         if (student.course_state == 'aprobo'):
             direccion = \
                 'http://certs.labviv.venesis.org.ve/?system=labviv&carnet='\
                 + str(student.cod_carnet) + '&ci=' + str(student.id_number)
             qr = QRCode(version=1, error_correction=ERROR_CORRECT_L)
             qr.add_data(direccion)
             qr.make(fit=True)
             im = qr.make_image()
             buffer_io = cStringIO.StringIO()
             im.save(buffer_io)
             student.qr_certificate = buffer_io.getvalue().encode('base64')
             student.qr_certificate = tools.image_resize_image(
                 student.qr_certificate, (200, 200))
Example #12
0
    def company_logo(self, dbname=None, **kw):
		imgname = 'logo'
		imgext = '.png'
		company_logo = request.env['website'].sudo().search([])[0].company_logo
		custom_logo = tools.image_resize_image(company_logo, (150, None))
		placeholder = functools.partial(get_module_resource, 'web', 'static', 'src', 'img')
		uid = None
		if request.session.db:
			dbname = request.session.db
			uid = request.session.uid
		elif dbname is None:
			dbname = db_monodb()

		if not uid:
			uid = openerp.SUPERUSER_ID

		if not dbname:
			response = http.send_file(placeholder(imgname + imgext))
		else:
			try:
				# create an empty registry
				registry = openerp.modules.registry.Registry(dbname)
				if custom_logo:
					image_base64 = custom_logo.decode('base64')
					image_data = StringIO(image_base64)
					imgext = '.' + (imghdr.what(None, h=image_base64) or 'png')
					response = http.send_file(image_data, filename=imgname + imgext, mtime=None)
				else:
					with registry.cursor() as cr:
						cr.execute("""SELECT c.logo_web, c.write_date
										FROM res_users u
								   LEFT JOIN res_company c
										  ON c.id = u.company_id
									   WHERE u.id = %s
								   """, (uid,))
						row = cr.fetchone()
						if row and row[0]:
							image_base64 = str(row[0]).decode('base64')
							image_data = StringIO(image_base64)
							imgext = '.' + (imghdr.what(None, h=image_base64) or 'png')
							response = http.send_file(image_data, filename=imgname + imgext, mtime=row[1])
						else:
							response = http.send_file(placeholder('nologo.png'))
			except Exception:
				response = http.send_file(placeholder(imgname + imgext))
                
		return response
Example #13
0
    def create_or_update_from_manifest(self, info, repository_branch,
                                       full_module_path):
        module_obj = self.env['odoo.module']
        module_version = self.search([
            ('technical_name', '=', str(info['technical_name'])),
            ('repository_branch_id', '=', repository_branch.id)
        ])

        if not module_version:
            # Create new module version
            module = module_obj.create_if_not_exist(info['technical_name'])
            module_version = self.create(
                self.manifest_2_odoo(info, repository_branch, module))

        else:
            # Update module Version
            value = self.manifest_2_odoo(info, repository_branch,
                                         module_version.module_id)
            module_version.write(value)
        icon_path = False
        for current_icon_path in self._ICON_PATH:
            full_current_icon_path = os.path.join(full_module_path,
                                                  current_icon_path,
                                                  'icon.png')
            if os.path.exists(full_current_icon_path):
                icon_path = full_current_icon_path
        if icon_path:
            resized_image = False
            try:
                with open(icon_path, 'rb') as f:
                    image = f.read()
                resized_image = tools.image_resize_image(
                    image.encode('base64'),
                    size=(96, 96),
                    encoding='base64',
                    filetype='PNG')
            except Exception:
                _logger.warn("Unable to read or resize %s" % icon_path)
            module_version.write({'image': resized_image})
Example #14
0
 def _resize(self, image, size_x, size_y):
     return image_resize_image(image.datas, size=(size_x, size_y))
Example #15
0
 def _compute_images(self):
     for rec in self:
         rec.image_xlarge = tools.image_resize_image_big(rec.image)
         rec.image_large = tools.image_resize_image(rec.image, (384, 384),
                                                    'base64', None, True)
         rec.image_medium = tools.image_resize_image_medium(rec.image)
Example #16
0
 def _get_logo_web(self, cr, uid, ids, _field_name, _args, context=None):
     result = dict.fromkeys(ids, False)
     for record in self.browse(cr, uid, ids, context=context):
         size = (180, None)
         result[record.id] = image_resize_image(record.partner_id.image, size)
     return result
 def init(self, cr):
     img=open(os.path.join(os.path.dirname(__file__), 'static', 'src', 'img','logo.png'), 'rb') .read().encode('base64')
     cr.execute('UPDATE res_partner SET image=%s WHERE is_company=TRUE', (img,))
     size = (180, None)
     cr.execute('UPDATE res_company SET logo_web=%s', (image_resize_image(img, size),))
Example #18
0
def deal_image_resize_image_wide(base64_source, size=(1280, 720), encoding='base64', filetype=None, avoid_if_small=True):
    return tools.image_resize_image(base64_source, size, encoding, filetype, avoid_if_small)
Example #19
0
    def order_line_create(self, cr, uid, ids, context=None):

        sale_order_line_obj = self.pool.get('sale.order.line')
        select_type = self.browse(cr, uid, ids, context=context)[0].select_type
        type_fix = self.browse(cr, uid, ids, context=context)[0].type_fixe
        inegalite = self.browse(cr, uid, ids, context=context)[0].inegalite
        vitrage = self.browse(cr, uid, ids, context=context)[0].vitre
        type_vitre = self.browse(cr, uid, ids, context=context)[0].type_vitre
        decoratif = self.browse(cr, uid, ids, context=context)[0].decoratif
        serr = self.browse(cr, uid, ids, context=context)[0].serr
        poigne = self.browse(cr, uid, ids, context=context)[0].poigne
        nb_poigne = self.browse(cr, uid, ids, context=context)[0].nb_poigne
        nb_serr = self.browse(cr, uid, ids, context=context)[0].nb_serr
        oscillo_battant = self.browse(cr, uid, ids,
                                      context=context)[0].oscillo_battant
        va_et_vient = self.browse(cr, uid, ids, context=context)[0].va_et_vient
        butoir = self.browse(cr, uid, ids, context=context)[0].butoir
        remplissage_vitre = self.browse(cr, uid, ids,
                                        context=context)[0].remplissage_vitre
        cintre = self.browse(cr, uid, ids, context=context)[0].cintre
        triangle = self.browse(cr, uid, ids, context=context)[0].triangle
        division = self.browse(cr, uid, ids, context=context)[0].division
        nb_division = self.browse(cr, uid, ids, context=context)[0].nb_division
        laque = self.browse(cr, uid, ids, context=context)[0].laque
        moustiquaire = self.browse(cr, uid, ids,
                                   context=context)[0].moustiquaire
        type_moustiquaire = self.browse(cr, uid, ids,
                                        context=context)[0].type_moustiquaire
        tms = self.browse(cr, uid, ids, context=context)[0].tms
        rec_largeur = self.browse(cr, uid, ids, context=context)[0].largeur
        rec_hauteur = self.browse(cr, uid, ids, context=context)[0].hauteur
        intermediaire = self.browse(cr, uid, ids,
                                    context=context)[0].intermediaire
        rec_dimension = self.browse(cr, uid, ids, context=context)[0].dimension
        rec_pu_ttc = self.browse(cr, uid, ids, context=context)[0].pu_ttc
        rec_ref = self.browse(cr, uid, ids, context=context)[0].order_ref
        rec_qty = self.browse(cr, uid, ids, context=context)[0].quantity
        #rec_total = self.browse(cr, uid, ids, context=context)[0].totalcacher
        total = self.calcul(cr, uid, ids, rec_largeur, rec_hauteur,
                            rec_dimension, rec_pu_ttc, rec_qty, select_type.id,
                            vitrage.id, type_vitre, decoratif.id, poigne.id,
                            serr.id, nb_poigne, nb_serr, oscillo_battant,
                            va_et_vient, butoir, remplissage_vitre, cintre,
                            triangle, division, nb_division, laque,
                            moustiquaire, type_moustiquaire, tms, context)
        image = self.browse(cr, uid, ids, context=context)[0].image

        #### début de formatisation de champ select_type pour evité d'afficher par ex coullissante2vtx ####
        types = select_type.name
        vitre = ''
        poignee = ''
        btr = ''
        oscillo = ''
        v_et_v = ''
        rempli = ''
        ctr = ''
        lq = ''
        trgl = ''
        mstqr = ''
        dvs = ''
        tmss = ''
        simple_double = ''
        deco = ''
        #name = ''
        intermdr = ''
        inegalit = ''

        if type_vitre:
            if type_vitre == 'double':
                simple_double = ' double,'

        dec = decoratif.name
        if ((decoratif.name is not None) and (decoratif.name != False)):
            if dec == u'Compliqué':
                deco = u' compliqué,'
        if intermediaire:
            if intermediaire == 'sans':
                intermdr = ''
            if intermediaire == 'avec':
                intermdr = u' avec intermédiaire, '
        if inegalite:
            if inegalite == 'egaux':
                inegalit = ''
            if inegalite == u'inegaux':
                inegalit = u'inégaux,'
        if ((vitrage.name == False) or (vitrage.name is None)):
            vitre = '\n - Vitrage : standard, '
        else:
            vitre = u"\n - Vitrage : " + vitrage.name + ", "
        if ((poigne.name is not None) and (poigne.name != False)):
            poignee = u'' + poigne.name + ''

        if butoir:
            btr = " avec butoir, "
        if va_et_vient:
            v_et_v = " avec va et vient,"
        if oscillo_battant:
            oscillo = " oscillo battant, "
        if remplissage_vitre:
            if remplissage_vitre == 'standard':
                remplissage_vitre = ''
            if remplissage_vitre == u'pleine_2_3':
                remplissage_vitre = u'2/3 pleine'
            if remplissage_vitre == u'pleine_1_2':
                remplissage_vitre = u'1/2 pleine'
            if remplissage_vitre == u'pleine_1_3':
                remplissage_vitre = u'1/3 pleine'
            if remplissage_vitre == u'pleine_bardage':
                remplissage_vitre = u'Pleine/bardage'

            rempli = " " + str(remplissage_vitre) + ", "
        if cintre:
            ctr = u" cintré, "
        if laque:
            lq = u" laqué, "
        if triangle:
            trgl = u" Triangle, "
        if moustiquaire:
            mstqr = "  avec moustiquaire "
        if division:
            if (nb_division > 1):
                dvs = " " + str(nb_division) + " divisions, "
            else:
                dvs = " " + str(nb_division) + " division, "
        if tms != 0.0:
            tmss = " TMS, "

        type_porte = u'Fenêtre'
        if types == 'Coulissante 2VTX':
            serrure = ''
            if tms != 0.0:
                type_porte = 'Porte'
            if serr.name is not None:
                if moustiquaire:
                    serrure = u' 2 serrures encastrées 2 points '
                else:
                    serrure = u' 1 poignee 4 points à  clef'
            else:
                if moustiquaire:
                    serrure = u' 2 serrures encastrées 2 points'
                else:
                    serrure = u' 1 poignee et 1 serrures encastrées 2 points'
            types = u" " + type_porte + " Coulissante 2VTX " + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl + " " + serrure +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"

        if types == 'Coulissante 1VTL':
            serrure = ''
            if serr.name is not None:
                if moustiquaire:
                    serrure = u' 2 serrures encastrées 2 points'
                else:
                    serrure = u' 1 poignée 4 points à  clef'
            else:
                if moustiquaire:
                    serrure = u' 2 serrures encastrées 2 points'
                else:
                    serrure = u' 1 poignée 2 points'
            types = u"Porte Coulissante 1VTL " + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl + " " + serrure +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == 'Glandage':
            types = "Glandage"
        if types == 'Coulissante 3VTX':
            serrure = ''
            if tms != 0.0:
                type_porte = 'Porte'
            if serr.name is not None:
                if moustiquaire:
                    serrure = u' 2 serrures encastrées 2 points'
                else:
                    serrure = u' 1 poignée 4 points à  clef et 1 serrure encastrée 2 point'
            else:
                if moustiquaire:
                    serrure = u' 2 serrures encastrées 2 points'
                else:
                    serrure = u' 1 poignée et 1 serrures encastrées 2 points'
            types = u" " + type_porte + " Coulissante 3VTX " + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl + " " + serrure +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == 'Coulissante 4VTX':
            serrure = ''
            if tms != 0.0:
                type_porte = 'Porte'
            if serr.name is not None:
                if moustiquaire:
                    serrure = u' 3 serrures encastrées 2 points'
                else:
                    serrure = u' 1 poignée 4 points à  clef'
            else:
                if moustiquaire:
                    serrure = u' 3 serrures encastrées 2 points'
                else:
                    serrure = u' 1 poignée et 2 serrures encastrées 2 points'
            types = u" " + type_porte + " Coulissante 4VTX " + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl + " " + serrure +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == 'Porte ouvrante 1VTL':
            types = u" Porte ouvrante 1VTL " + "\n - Accessoires :" + " ".join(
                (tmss + " " + intermdr + " " + dvs + " " + btr + " " +
                 oscillo + " " + v_et_v + " " + ctr + " " + lq + " " + trgl +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == u'Fenêtre ouvrante 1VTL':
            types = u" Fenêtre ouvrante 1VTL  " + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == 'Porte ouvrante 2VTX':
            types = u" Porte ouvrante 2VTX  " + "\n - Accessoires :" + " ".join(
                (inegalit + " " + tmss + " " + dvs + " " + btr + " " +
                 oscillo + " " + v_et_v + " " + ctr + " " + lq + " " + trgl +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == u'Fenêtre ouvrante 2VTX':
            types = u" Fenêtre ouvrante 2VTX  " + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"

        if types == 'A soufflet':
            types = u" A soufflet  " + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == 'Fixe':
            if type_fix:
                if type_fix == 'imposte':
                    types = "Imposte Fixe" + "\n - Accessoires :" + " ".join(
                        (tmss + " " + dvs + " " + btr + " " + oscillo + " " +
                         v_et_v + " " + ctr + " " + lq + " " + trgl +
                         " ").split()) + vitre + " ".join(
                             (simple_double + deco + " " + rempli + " " +
                              mstqr).split()) + " \n"
                if type_fix == 'soubassement':
                    types = "Soubassement Fixe" + "\n - Accessoires :" + " ".join(
                        (tmss + " " + dvs + " " + btr + " " + oscillo + " " +
                         v_et_v + " " + ctr + " " + lq + " " + trgl +
                         " ").split()) + vitre + " ".join(
                             (simple_double + deco + " " + rempli + " " +
                              mstqr).split()) + " \n"
                if type_fix == 'lateral':
                    types = u"Latéral Fixe" + "\n - Accessoires :" + " ".join(
                        (tmss + " " + dvs + " " + btr + " " + oscillo + " " +
                         v_et_v + " " + ctr + " " + lq + " " + trgl +
                         " ").split()) + vitre + " ".join(
                             (simple_double + deco + " " + rempli + " " +
                              mstqr).split()) + " \n"
            else:
                types = u"Fixe"
        if types == 'Moustiquaire':
            types = u"Moustiquaire indépendant"
        if types == 'Naco':
            types = u"Naco" + "\n - Accessoires :" + " ".join(
                (tmss + " " + dvs + " " + btr + " " + oscillo + " " + v_et_v +
                 " " + ctr + " " + lq + " " + trgl +
                 " ").split()) + vitre + " ".join(
                     (simple_double + deco + " " + rempli + " " +
                      mstqr).split()) + " \n"
        if types == 'Poteau rectangle' or 'Poteau d\'angle' or 'Tendeur':

            if types == 'Poteau rectangle':
                types = "Poteau rectangle"
            if types == 'Poteau d\'angle':
                types = "Poteau d'angle"
            if types == "Tendeur":
                types = "Tendeur"
            if types == 'Bardage PVC':
                types = "Bardage PVC"

        lxh = types
        if types == 'Poteau rectangle':
            if (rec_dimension and rec_pu_ttc):
                lxh = lxh + " \n\t - Dimension : %d x %d \n" % (
                    rec_dimension,
                    rec_pu_ttc,
                )
        else:
            if (rec_largeur and rec_hauteur):
                lxh = lxh + "- Dimension : %d x %d HT \n" % (
                    rec_largeur,
                    rec_hauteur,
                )

        name = lxh
        res_image = tools.image_resize_image(image, (64, 64), 'base64', 'PNG',
                                             False)
        sale_order_line_obj.create(
            cr, uid, {
                'product_id': select_type.id,
                'name': name,
                'order_id': rec_ref + 1,
                'product_uom_qty': rec_qty,
                'price_subtotal': total['totalcacher'],
                'price_unit': total['totalcacher'] / rec_qty,
                'image': res_image
            })
        return True