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
    • Intelligence artificielle
    • 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
    • Supermarché
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • 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
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Homme à tout faire
    • Matériel informatique & 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
    Parcourir toutes les 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
    • Devenir partenaire
    • Services pour partenaires
    • 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
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

Product not Avaliable in E-Shop

S'inscrire

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

Cette question a été signalée
webecommerceodooV8
1 Répondre
5107 Vues
Avatar
Luis Miguel Varón E

Hello

I'm developing a module that insert some columns to the product.attribute and product.attribute.value, but when i make a product with 2 variants itś get not available on the e-shop. This doesn happen without my module installed.

My code:

class product_colorisa_attribute(osv.osv):
    _inherit = "product.attribute.value"
    _columns = {
        'code' : fields.char('Codigo', size=3, required=True, help="Campo con capacidad de 3 caracteres, pero segun definicion de la codificacion de los productos ingresar unicamente 2 en caso de catalogar un Color, Sabor."),
        'scode' : fields.char('Sub Codigo', size=2, required=False, help="")
    }

class product_product(osv.osv):
    _inherit = 'product.product'
      
    def get_ref(self, cr, uid, ids,context=None):
        if isinstance(ids, (list, tuple)) and not len(ids):
            return []
        if isinstance(ids, (long, int)):
            ids = [ids]
        reads = self.browse(cr, uid, ids)
        res = []
        for records in reads:
            if records.categ_id.code:
                ref = records.categ_id.code + '' + records.linea_id.code + '' + records.marca_id.code
                for attribute in records.attribute_value_ids:
                    print attribute.code
                    if attribute.code:
                        ref = ref + '' + attribute.code
                if ref:
                    print ref
                    res.append((records['id'], ref))
        return res
        
    
    def _get_ref(self, cr, uid, ids, prop, unknow_none, context=None):
        res = self.get_ref(cr, uid, ids, context=context)
        return dict(res)

 _columns = {
        'ref' : fields.function(_get_ref, type='char', string='Internal Reference', store=True ),

}

Thanks for anything and forgive my english

0
Avatar
Ignorer
Avatar
Anton Chepurov
Meilleure réponse

This happens when your product.template has an attribute with a single value, e.g. Color: blue.

Here's what you could do:

diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index d700ef2..a1cc3e0 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -103,6 +103,7 @@ $('.oe_website_sale').each(function () {
 
     $(oe_website_sale).on('change', 'input.js_variant_change, select.js_variant_change', function (ev) {
         var $ul = $(this).parents('ul.js_add_cart_variants:first');
+        var $section = $(this).parents('#product_detail');
         var $parent = $ul.closest('.js_product');
         var $product_id = $parent.find('input.product_id').first();
         var $price = $parent.find(".oe_price:first .oe_currency_value");
@@ -112,6 +113,9 @@ $('.oe_website_sale').each(function () {
         $parent.find('input.js_variant_change:checked, select.js_variant_change').each(function () {
             values.push(+$(this).val());
         });
+        $section.find('span.js_variant_static').each(function () {
+            values.push(parseInt($(this).attr('value')));
+        });
 
         $parent.find("label").removeClass("text-muted css_not_available");

And override one template in your XML file:

        <template id="product_attributes" inherit_id="website_sale.product_attributes" name="Product attributes">
            <xpath expr="//span[@t-field='variant_id.value_ids[0].name']" position="attributes">
                <attribute name="t-att-value">variant_id.value_ids[0].id</attribute>
                <attribute name="class">js_variant_static</attribute>
            </xpath>
        </template>

 

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é
Avoid negative stock on eCommerce
web html ecommerce odooV8
Avatar
Avatar
2
mai 21
8219
Odoo 8 web unique field constraint ?
web odooV8
Avatar
0
avr. 15
4907
How to add web references in our customers after installed module?
web ecommerce
Avatar
0
mars 15
5026
Duplicate Résolu
ecommerce webshop odooV8
Avatar
Avatar
1
déc. 24
19302
How to build a page in odoo with featured products
web tags ecommerce
Avatar
Avatar
1
sept. 23
5427
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
  • Devenir 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 Svenska ภาษาไทย 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