This question has been flagged

Basically first-time OE developer here with a problem on buttons. I have a module that inherits from product, and has a related project. I would like to have a button to click that shows Issues that have the same project.

Related Issues

So clicking "Related Issues" should load:

Issues

But I'm having trouble getting the Search button to show criteria as occurs when you click the Meetings / Calls / Opportunities buttons on the customers form, for example.

Here's the code I'm working with so far, but likely with mistakes in Action & Button!

<record id="action_appliance_issues" model="ir.actions.act_window">
    <field name="name">Appliance Issues</field>
    <field name="res_model">project.issue</field>
    <field name="type">ir.actions.act_window</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    <field name="domain">[('project_id','=', active_id)]</field>
    <field name="help" type="html">
        <p class="oe_view_nocontent_create">
            Click to create a new issue.
        </p>
        <p>
            This is the list of all the Issues 
            related to this Appliance Server.
        </p>
    </field>
</record>

<button string="Related Issues" 
        name="%(action_appliance_issues)d" 
        context="{'project_id': active_id}"
        type="action"/>

Edit: 02/05/14

Ok, I did learn something here. If I change this line

    <field name="domain">[('project_id','=', active_id)]</field>

To this:

    <field name="domain">[('project_id','=', 'martinsauto')]</field>

Then the lookup works as I expected. 'martinsauto' is the text string value of the 'name' field. So how can I access the string value of the 'name' field? I tried the following, but it doesn't work...

    <field name="domain">[('project_id','=', active_id.name)]</field>

Any help here for a beginner?

TIA!

Avatar
Discard