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

Getting an access error on act_window

v8
By
Kit Sunde
on 9/17/14, 5:23 AM 1,241 views

I have the following XML which adds a button to the partner form view. I'm trying to link to another view.

<?xml version="1.0"?>
<openerp>
  <data>
    <record id="res_partner_view_buttons" model="ir.ui.view">
      <field name="name">res.partner.view.buttons</field>
      <field name="model">res.partner</field>
      <field name="inherit_id" ref="base.view_partner_form"/>
      <field name="arch" type="xml">
        <xpath expr="//div[@name='buttons']" position="inside">
          <button class="oe_inline oe_stat_button"
                  type="action"
                  string="Test"
                  context="{'search_default_partner_id': active_id}"
                  name="action_open_scheduled_emails"
                  icon="fa-envelope-o">
            Scheduled Emails
          </button>
        </xpath>
      </field>
    </record>

    <record id="action_open_scheduled_emails" model="ir.actions.act_window">
      <field name="name">View Scheduled Emails</field>
      <field name="res_model">sale.order_email.scheduled_email</field>
      <field name="view_type">tree</field>
      <field name="view_mode">tree</field>
    </record>
  </data>
</openerp>

Clicking the button results in:

 

AccessError

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: ir.actions.actions, Operation: read)

I'm logged in as the admin and can view the models normally. What have  I done wrong?

4

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 9/17/14, 6:06 AM

When the button type is "action", you have to link the action_id, which will be treated as ID by Openerp...

Here your code should like this

  <button class="oe_inline oe_stat_button"
                  type="action"
                  string="Test"
                  context="{'search_default_partner_id': active_id}"
                  name="%(action_open_scheduled_emails)d"
                  icon="fa-envelope-o">

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: 9/17/14, 5:23 AM
Seen: 1241 times
Last updated: 3/16/15, 8:10 AM