Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

multiple images with preview in products

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
pythonxmlpython2.7odooodoo10
2 Réponses
13405 Vues
Avatar
Gautam

How to create multiple images with its preview in product template? Here is my code :-


from openerp import models, fields, api


class product_image(models.Model):
_name = 'product.image'
_order = 'sequence, id DESC'

name = fields.Char('Name')
description = fields.Text('Description')
sequence = fields.Integer('Sequence')
image_alt = fields.Text('Image Label')
image = fields.Binary('Image')
image_small = fields.Binary('Small Image')
product_tmpl_id = fields.Many2one('product.template', 'Product', select=True)
from_main_image = fields.Boolean('From Main Image', default=False)


class product_product(models.Model):
_inherit = 'product.product'

images = fields.One2many('product.image', related='product_tmpl_id.images',
string='Images', store=False)


class product_template(models.Model):
_inherit = 'product.template'

images = fields.One2many('product.image', 'product_tmpl_id',
string='Images')

@api.one
def action_copy_image_to_images(self):
if not self.image:
return
image = None
for r in self.images:
if r.from_main_image:
image = r
break

if
image:
image.image = self.image
else:
vals = {'image': self.image,
'name': self.name,
'product_tmpl_id': self.id,
'from_main_image': True, }
self.env['product.image'].create(vals)

xml code:-
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_product_template_only_form_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//notebook[1]" position="inside">
<page string="Product Images" name="website_mutli_image">
<field name="images" context="{'default_name': name}">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="description"/>
<field name="image_alt"/>
<field name="image" widget="image" height="64"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
<record id="product_product_product_only_form_view" model="ir.ui.view">
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//notebook[1]" position="inside">
<page string="Product Images" name="website_mutli_image">
<field name="images" mode="kanban" context="{'default_name': name}">
<kanban>
<field name="name"/>
<field name="description"/>
<field name="image_alt"/>
<field name="image"/>
<templates>
<t t-name="kanban-box">
<div style="position: relative">
<div class="oe_module_vignette">
<a type="open">
<img t-att-src="kanban_image('res.partner', 'image', record.id.value, {'preview_image': 'image_small'})" class="oe_avatar oe_kanban_avatar_smallbox"/>
</a>
<div class="oe_module_desc">
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border">
<table class="oe_kanban_table">
<tr>
<td class="oe_kanban_title1" align="left" valign="middle">
<h4><a type="open"><field name="name"/></a></h4>
<i><div t-if="record.description.raw_value">
<field name="description"/></div></i>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</page>
</xpath>
</field>
</record>

</data>
</openerp>
0
Avatar
Ignorer
Avatar
Nikhil Krishnan
Meilleure réponse

you just install the e-commerce, and there is the option for multiple images in products. please refer it, it will help you.

https://www.odoo.com/documentation/user/10.0/ecommerce/managing_products/multi_images.html

2
Avatar
Ignorer
Avatar
swapnil trivedi
Meilleure réponse

You can use this module http://bit.ly/2yOKX5o. This can be the answer for your question

0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Product Pack and its product visiblity in sale order
python xml python2.7 odoo odoo10
Avatar
Avatar
1
oct. 17
2980
[SOLVED] How to Hide or Delete Trash Icon in One2many field Résolu
python python2.7 odoo odoo10
Avatar
Avatar
2
août 25
12968
Filter value 2 field of Many2one
python python2.7 odoo odoo10
Avatar
Avatar
Avatar
5
sept. 20
7027
Filter field domain one2many to many2one Résolu
python python2.7 odoo odoo10
Avatar
Avatar
1
déc. 19
10386
[Solved] Inherit fields to existing tables Résolu
python python2.7 odoo odoo10
Avatar
Avatar
Avatar
4
janv. 19
10362
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now