Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Odoo 10 - 403 forbidden error for images for public visitors

Odebírat

Get notified when there's activity on this post

This question has been flagged
securityxmlodoo10.0
1 Odpovědět
8730 Zobrazení
Avatar
youta

Hello,

I'm working on online quotation report customization, to display the products images on the quotation for the customer.

Everything is working just fine except of when the customer click on the quotation link sent by email, it directs him to the quotation but some of products images aren't loaded and it gives 404 forbidden error in the console. However if the customer logged in it will be displayed just fine.

Here's a sample of my code:


<template id="so_custom_quotation_content" inherit_id="website_quote.so_quotation_content" name="Custom Quotation">
        <xpath expr="//div[@class='oe_structure']" position="after">
            <section id="productdetails">
                <t t-foreach="quotation.order_lines_layouted()" t-as="page">
                    <table class="table table-condensed wq-table">
                        <thead>
                            <tr>
                                <th>Product</th>
                                <th></th>
                                <th></th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            <t t-foreach="page" t-as="layout_category">
                                <t t-if="layout_category_size > 1 or page_size > 1" groups="sale.group_sale_layout">
                                    <tr class="active">
                                        <td colspan="7" style="font-weight: bold; border-bottom: 1px solid black;">&amp;bull;
                                            <t t-esc="layout_category['name']"/>
                                        </td>
                                    </tr>
                                    <tr></tr>
                                </t>
                                <t t-foreach="layout_category['lines']" t-as="line">
                                    <tr t-attf-class="product-description row-{{line_parity}}">
                                        <td style="padding:20px;" t-foreach="line.product_id" t-as="pro">
                                            <span t-field="pro.image_medium" t-field-options='{"widget": "image","class": "oe_avatar"}' style="padding:20px;"/>
                                        </td>
                                        <td></td>
                                        <td></td>
                                        <td class="colored">
                                            <p t-field="line.name"/>
                                        </td>
                                    </tr>
                                </t>
                            </t>
                        </tbody>
                    </table>
                    <t t-if="page_index &lt; page_size - 1" groups="sale.group_sale_layout">
                        <p style="page-break-before:always;"></p>
                    </t>
                </t>
            </section>
     </xpath>
</template>

Screenshot of the error for unregistered people

Can anyone help me to fix that error. Much appreciation and thanks in advance


PS. I'm using Nginx reverse proxy

0
Avatar
Zrušit
Avatar
Denis Baranov
Nejlepší odpověď

The issue is stipulated by access rights of public users to products:

  1. When a user is not logged in, he/she is a "Public user"

  2. Public user has rights to read products (e.g.: look at the 'website_sale' addon, the rule 'access_product_product_public')

  3. Image_medium which you try to show is a computed fields with inverse, what requires more rights

The recommendations (alternatively):

  1. Redefine the functions to compute images, adding 'sudo'

  2. Add the special rights for public users via csv (may be not SAFE)

  3. Keep an image in another model.

Example of the last advise:

class avatar(models.Model):

    _name = 'avatar.avatar'

   

    image = fields.Binary(string='Image')

    product_id = fields.Many2one('product.product',string='Product')

class product_product(models.Model):

    _inherit = 'product.product'

   

    @api.one

    @api.depends('image_medium')

    def get_avatar(self):

        if self.avatar:

            self.avatar.image = self.image_medium

        else:

            avatar_id = self.env['avatar.avatar'].create({'product_id':self.id,'image': self.image_medium})

            self.avatar = avatar_id

   

    avatar = fields.Many2one('avatar.avatar',string="Avatar",compute="get_avatar",compute_sudo=True,store=True)

The rule for avatar:

access_avatar_avatar,access_avatar_avatar,model_avatar_avatar,,1,0,1,0

Afterwards, instead of image_medium in your template, use avatar.image

1
Avatar
Zrušit
youta
Autor

Perfect, thanks

youta
Autor

Well the presented solution helped me to overcome the 403 forbidden error. Now I'm facing another problem that the images are always cashed in the quotation table, no matter I try to remove or change the original product image, nothing changes in the online quotation. Any advice?

Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Adding bullets in odoo 10 qweb report.
xml odoo10.0
Avatar
0
čvn 22
3397
Setting up rules' Access Right in xml,csv files
security xml rules
Avatar
1
pro 22
26117
Hiding Attachments button on a specific model's form view in odoo 10.
xml python2.7 odoo10.0
Avatar
0
srp 22
3250
How to create user Group Application for your module? Vyřešeno
security xml group
Avatar
Avatar
6
led 21
45918
inherit some group permissions to another group Vyřešeno
security xml odoo11.0
Avatar
Avatar
1
pro 23
11692
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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