Odoo Help

1

Portal User AccessError Opening Invoice or Picking Ticket

By
APR, LLC
on 11/11/16, 9:51 PM 662 views

I have an install from GIT that is giving me an error whenever a portal user tries to open an Invoice or Delivery Order, but regular Orders work just fine. 


This is the error in the log:

Traceback (most recent call last):
  File "/opt/odoo/odoo-10.0/addons/website/models/ir_http.py", line 264, in _handle_exception
 response = super(Http, cls)._handle_exception(exception)
 File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_http.py", line 169, in _handle_exception
 return request._handle_exception(exception)
 File "/opt/odoo/odoo-10.0/odoo/http.py", line 766, in _handle_exception
 return super(HttpRequest, self)._handle_exception(exception)
 File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_http.py", line 195, in _dispatch
 result = request.dispatch()
 File "/opt/odoo/odoo-10.0/odoo/http.py", line 825, in dispatch
 r = self._call_function(**self.params)
 File "/opt/odoo/odoo-10.0/odoo/http.py", line 331, in _call_function
 return checked_call(self.db, *args, **kwargs)
 File "/opt/odoo/odoo-10.0/odoo/service/model.py", line 119, in wrapper
 return f(dbname, *args, **kwargs)
 File "/opt/odoo/odoo-10.0/odoo/http.py", line 324, in checked_call
 result = self.endpoint(*a, **kw)
 File "/opt/odoo/odoo-10.0/odoo/http.py", line 933, in __call__
 return self.method(*args, **kw)
 File "/opt/odoo/odoo-10.0/odoo/http.py", line 504, in response_wrap
 response = f(*args, **kw)
 File "/opt/odoo/odoo-10.0/addons/report/controllers/main.py", line 45, in report_routes
 pdf = report_obj.with_context(context).get_pdf(docids, reportname, data=data)
 File "/opt/odoo/odoo-10.0/addons/report/models/report.py", line 165, in get_pdf
 html = self.with_context(context).get_html(docids, report_name, data=data)
 File "/opt/odoo/odoo-10.0/addons/report/models/report.py", line 139, in get_html
 return self.render(report.report_name, docargs)
 File "/opt/odoo/odoo-10.0/addons/report/models/report.py", line 115, in render
 return view_obj.render_template(template, values)
 File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_ui_view.py", line 1029, in render_template
 return self.browse(self.get_view_id(template)).render(values, engine)
 File "/opt/odoo/odoo-10.0/addons/website/models/ir_ui_view.py", line 110, in render
 return super(View, self).render(values, engine=engine)
 File "/opt/odoo/odoo-10.0/addons/web_editor/models/ir_ui_view.py", line 26, in render
 return super(IrUiView, self).render(values=values, engine=engine)
 File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_ui_view.py", line 1049, in render
 return self.env[engine].render(self.id, qcontext)
 File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_qweb/ir_qweb.py", line 53, in render
 return super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
  File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_qweb/qweb.py", line 248, in render
 self.compile(template, options)(self, body.append, values or {})
 File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_qweb/qweb.py", line 317, in _compiled_fn
 raise e
QWebException: (u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: res.partner, Operation: read)', None)
Traceback (most recent call last): File "/opt/odoo/odoo-10.0/odoo/addons/base/ir/ir_qweb/qweb.py", line 315, in _compiled_fn
 return compiled(self, append, values, options, log)
 File "<template>", line 1, in template_report_external_layout_footer_500
 File "/opt/odoo/odoo-10.0/odoo/fields.py", line 872, in __get__
 value = record._cache[self]
 File "/opt/odoo/odoo-10.0/odoo/models.py", line 5526, in __getitem__
 return value.get() if isinstance(value, SpecialValue) else value
 File "/opt/odoo/odoo-10.0/odoo/fields.py", line 48, in get
 raise self.exception
AccessError: (u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: res.partner, Operation: read)', None) Error to render compiling AST
AccessError: (u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: res.partner, Operation: read)', None)
Template: report.external_layout_footer
Path: /templates/t/div/div/ul[1]/li[2]
Node: <li t-if="company.fax and company.phone" data-oe-id="352" data-oe-model="ir.ui.view" data-oe-field="arch" data-oe-xpath="/t[1]/div[1]/div[1]/ul[1]/li[2]">&amp;bull;</li>

This seems to be related to record rule: res_partner: portal/public: read access on my commercial partner

The report.external_layout_footer references data from the companies partner record and this rule prevents that access.

The rule as it stands is like this: [('id', 'child_of', user.commercial_partner_id.id)]

How do I write this rule to also include the company_id of the user or one of the company_ids for the user in multi-company?

APR, LLC
on 11/17/16, 4:11 PM
0
Thomas Dreiling
On 6/21/17, 7:37 AM

I ran into the same problem just now. The cause of this is that the portal user does not have any access rights to the partner data of the company itself which is used in my report template and the external footer, as well. I solved this by going to Settings - Users - Groups, editing "Other Extra Rights / Portal", tab "Rules", clicking "Add an item", clicking "Create" and using the following settings:

  • Name: Company Data (or whatever you like to call it)

  • Uncheck all access rights but "Apply for Read" as only read access should be granted

  • Object: Partner (res.partner)

  • Rule Definition: [('id', '=', 1)]

  • Groups: Other Extra Rights / Portal

This might not be the most elegant of solutions but this works for us as we don't use multiple companies. Could be changed to 'id in <list of your companies' partner ids>'. Maybe the '1' can be replace by ref['base.company']... or some construct like this. Didn't try. If someone cares to check this, please report your findings.

0
Marco
On 5/21/17, 12:09 PM

Hi,

did you solve this? I have a similar issue that I get the access error once a portal user hits the "print" button to print a sales order or invoice.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/11/16, 9:51 PM
Seen: 662 times
Last updated: 6/21/17, 7:37 AM