Odoo Help

2

[SOLVED] Is posible change a domain_force in security.xml through a function in Python? (odoo 8)

By
dlsuarez
on 3/2/15, 5:56 AM 2,126 views

Hello,

I have a security file (./security/crm_request_security.xml) with the next code:

<record id="crm_rule_all_lead_crm_ticket_platforms" model="ir.rule">
            <field name="name">All Leads On CRM Ticket Platforms</field>
            <field ref="crm.model_crm_lead" name="model_id"/>
            <field name="domain_force">[(1,'=',1)]</field>
            <field name="groups" eval="[(4, ref('group_crm_ticket_platforms_coordinator'))]"/>
</record>

I wish to change the domain_force field through a function from Python, it is posible?

Thanks!

 

1
dlsuarez
On 3/10/15, 8:55 AM

Finally we could solve this issue.

We use ir.actions.server in the specific view changing the domain through the code attribute:

<record id="crm_act_server_opportunities" model="ir.actions.server">
    <field name="name">Opportunities</field>
    <field name="model_id" ref="crm.model_crm_lead"/>
    <field name="condition">True</field>
    <field name="code">
        action = {
            "type": "ir.actions.act_window",
            "view_mode": "kanban,tree,graph,form,calendar",
            "res_model": "crm.lead",
            "domain": unicode(self._set_domain(cr, uid, context)),
        }
    </field>
</record>

is it possible to change domain w.r.t to a context value passed?

Atchuthan - Technical Consultant, Sodexis Inc
on 3/16/15, 5:59 AM

also, why do we need to typecast it to unicode format?

Atchuthan - Technical Consultant, Sodexis Inc
on 3/16/15, 6:10 AM
0

Hi,

It is some how possible but it is not good. You can make one python function into __init__.py file which will change the content of your crm_request_security.xml file. You can manage changes using xml file handling.

I think are you looking for this kind of solution.

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

3 follower(s)

Stats

Asked: 3/2/15, 5:56 AM
Seen: 2126 times
Last updated: 3/16/15, 8:10 AM