Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

I want to hide some res.partner address fields on the website from public visitors. I used a CSV file with READ permissions on res.partner to do this but it isn't working

By
Md. Tanzilul Hasan Khan
on 11/15/16, 11:29 AM 139 views

I have address fields on my website and I can't show them to public visitors. I have written following line to security CSV file -

access_res_partner,res_partner,base.model_res_partner,,1,0,0,0

The module is upgrading but page not showing for public visitors.


Did you add csv file in __openerp__.py file ?

shameem@aχoncoms
on 11/16/16, 12:29 AM

yes, I did.

Md. Tanzilul Hasan Khan
on 11/16/16, 1:49 AM
1

It was solved with this:

<span t-field="event.address_id.sudo().city"/>,                                
<span t-field="event.address_id.sudo().country_id.name"/>
1

Hilar AK

--Hilar AK--
778
| 4 1 7
Italy
--Hilar AK--


Hilar AK
On 11/16/16, 2:22 AM

HI Tanzilul,

You can inherit the website template and give a condition to display your field,

eg t-if = "not public visitor[portal group or your custom group]" t-esc="yourfield"

hence the public users cant see the field,

if you provide your code here I can answer you by code

The new module is made by inheriting existing module. I got it solved. Thanks.

Md. Tanzilul Hasan Khan
on 11/17/16, 9:43 PM
1
shameem@aχoncoms
On 11/16/16, 3:35 AM

Tanzil,

I tried to override the existing access right

https://www.odoo.com/forum/help-1/question/how-to-make-a-model-is-fully-public-108950

But I could not find it.

Then I directly changed under the settings menu

Activate developer mode
Settings -> Technical -> Database Structure -> model -> res.partner -> Access rights

Thanks !

Shameem, I found a workaround by using sudo. I can't use the backend because the access has to come with module installed. Thanks :)

<span t-field="event.address_id.sudo().city"/>

<span t-field="event.address_id.sudo().country_id.name"/>

Md. Tanzilul Hasan Khan
on 11/17/16, 9:42 PM
0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 11/16/16, 1:45 AM

Odoo provides 3 kinds/levels of Security access to control the data.

  1. Object Access Control

  2. Record Rules

  3. Field Access

To Control displaying of records/data, you need to use Security Record Rules.

Similarly to control couple of fields on the view, you need to use Groups to define Field Access in the XML Views.


Permissions which are defined in the CSV, will merely act as Object Permission and certainly not on the data/record present in the object.

For more details Refer this Odoo Security

I know these, but for some reason the csv security access not working.

Md. Tanzilul Hasan Khan
on 11/16/16, 1:53 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/15/16, 11:29 AM
Seen: 139 times
Last updated: 11/17/16, 9:41 PM