İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

How to avoid sale order automaticaly created for public user in the website shop?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
shopnginxurlsitemaprobots.txt
2 Cevaplar
12058 Görünümler
Avatar
Pascal Tremblay

Hello there,

We have a site on Odoo 8. The shop works well at http://cferalma.com/shop. 

But it is only a catalog. Users can't buy on this site. No "add to cart" button, nowhere.

But sometimes (often), sale order are created for the public user in the sales. We don't want these sale orders.

I will publish below our solution for this problem. May be it could help somebody.

Thanks to comment.

0
Avatar
Vazgeç
Avatar
Pascal Tremblay
Üretici En İyi Yanıt

Here is our solution. We hope it could help somebody.

I hope you could comment this solution! May be we are not right.


Comment

Since there is no link for these 6 links on our website, we want they become inaccessible, even if they are written directly in browser address bar :

/shop/cart

/shop/payment/validate

/shop/confirm_order

/shop/confirmation

/shop/payment

/shop/checkout

We are pretty sure that this is the problem for all those sale orders automatically created. So we don't want those links appear in search engine. More, we also don't want those links work at all if the user write it in directly in his browser address bar.


First move : modify the robots.txt file

In a custom module, we put this code :

<?xml version="1.0" encoding="UTF-8"?>
<openerp>

<template id="website.robots">

User-agent: *

Disallow: /shop/cart

Disallow: /shop/payment/validate

Disallow: /shop/confirm_order

Disallow: /shop/confirmation

Disallow: /shop/payment

Disallow: /shop/checkout

Sitemap:<t t-esc="url_root"/>sitemap.xml

</template>

</data>

</openerp>



Second move : modify the sitemap.xml

We override the enumerate_pages method of the website class :

import logging

logger = logging.getLogger(__name__)

from openerp.osv import osv

from openerp.addons.web.http import request

class website(osv.osv):

_inherit = "website"

def enumerate_pages(self, cr, uid, ids, query_string=None, context=None):

logger.error("enumerate_pages BEGIN")

""" Available pages in the website/CMS. This is mostly used for links

generation and can be overridden by modules setting up new HTML

controllers for dynamic pages (e.g. blog).

By default, returns template views marked as pages.

:param str query_string: a (user-provided) string, fetches pages

matching the string

:returns: a list of mappings with two keys: ``name`` is the displayable

name of the resource (page), ``url`` is the absolute URL

of the same.

:rtype: list({name: str, url: str})

"""

router = request.httprequest.app.get_db_router(request.db)

# Force enumeration to be performed as public user

url_list = []

for rule in router.iter_rules():

if not self.rule_is_enumerable(rule):

continue

converters = rule._converters or {}

if query_string and not converters and (query_string not in rule.build([{}], append_unknown=False)[1]):

continue

values = [{}]

convitems = converters.items()

# converters with a domain are processed after the other ones

gd = lambda x: hasattr(x[1], 'domain') and (x[1].domain <> '[]')

convitems.sort(lambda x, y: cmp(gd(x), gd(y)))

for (i,(name, converter)) in enumerate(convitems):

newval = []

for val in values:

query = i==(len(convitems)-1) and query_string

for v in converter.generate(request.cr, uid, query=query, args=val, context=context):

newval.append( val.copy() )

v[name] = v['loc']

del v['loc']

newval[-1].update(v)

values = newval

logger.error(" values :: %s", str(values))

for value in values:

domain_part, url = rule.build(value, append_unknown=False)

page = {'loc': url}

for key,val in value.items():

if key.startswith('__'):

page[key[2:]] = val

 

if url in ('/sitemap.xml','/shop/cart','/shop/payment','/shop/payment/validate','/shop/confirm_order','/shop/confirmation','/shop/checkout',):

logger.error(" this url was avoid : %s",str(url))

continue

if url in url_list:

continue

url_list.append(url)

logger.error(" page :: %s", str(page))

yield page



Third move : redirect url in nginx

upstream odoo-cfer {

server 127.0.0.1:8077;

}

server {

listen 80;

server_name cferalma.com;

location / {

proxy_pass http://odoo-cfer;

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto https;

}

location ~* /web/static/ {

proxy_cache_valid 200 60m;

proxy_buffering on;

expires 864000;

proxy_pass http://odoo-cfer;

}

location = /shop/cart {

return 301 http://cferalma.com/shop;

}

location = /shop/payment/validate {

return 301 http://cferalma.com/shop;

}

location = /shop/confirm_order {

return 301 http://cferalma.com/shop;

}

location = /shop/confirmation {

return 301 http://cferalma.com/shop;

}

location = /shop/payment {

return 301 http://cferalma.com/shop;

}

location = /shop/checkout {

return 301 http://cferalma.com/shop;

}

error_page 502 /502.html;

location = /502.html {

root /usr/share/nginx/html;

}

}



2
Avatar
Vazgeç
Avatar
Fatih Piristine
En İyi Yanıt

rewriting the controller in a custom module would be way handier. no need to bubble up the webserver conf.

also adding a column to website model would make easier to configure for later use of excluding things from sitemaps.

class website(osv.osv):
_inherit = 'website'

_columns = {
'google_tags_manager_key': fields.char('Google Tags Manager'),
'exclude_from_sitemap': fields.text('Exclude from sitemap')
}


def enumerate_pages ( ... )
...
    exclude_from_sitemap = []

    if current_website.exclude_from_sitemap:
    exclude_from_sitemap = current_website.exclude_from_sitemap.splitlines()
...


...
if url in ('/sitemap.xml',) or url in exclude_from_sitemap:
continue
if url in url_list:
continue
if not published:
continue
url_list.append(url)

yield page


1
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Google can't fetch Odoo robots.txt (Failed: Robots.txt unreachable) Çözüldü
google sitemap robots.txt
Avatar
1
Nis 23
4862
Urls are not showing in HTTPs version
website sitemap robots.txt
Avatar
Avatar
1
Oca 23
4712
Setting URL for access to Odoo
nginx url v14
Avatar
Avatar
1
Haz 21
8659
direct url shop of a base Çözüldü
shop url direct
Avatar
Avatar
2
Kas 20
4483
How to avoid wrong domain in my sitemap.xml? Çözüldü
domain url sitemap
Avatar
1
Ara 16
8775
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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