Odoo Help

0

0
2 回答
1
アバター

Akhil P Sivan インド

--Akhil P Sivan--

5951
| 6 5 9
Kochi, インド
--Akhil P Sivan--

Odoo Developer

email-id : akhilpsivan01@gmail.com

Akhil P Sivan インド
2019/04/15 6:26

Hi, your changes on res_partner_rule from your custom_module is not affected because that record rule is set in the base module xml file with noupdate="1"

And also if you notice, that rule is inactive by default.

<record model="ir.rule" id="res_partner_rule">
<field name="name">res.partner company</field>
<field name="model_id" ref="base.model_res_partner"/>
<!--
Show partners from ancestors and descendants companies
(or company-less), this is usually a better default for
multicompany setups.
-->
<field name="domain_force">['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
<field name="active" eval="False"/>
</record>

So before modifying the rule, just enable that default rule n try if it solves your issue. 

if not, you may check this link to understand how to override the record values set with noupdate="1", from your custom module. For eg:

<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'base'), ('name', '=', 'res_partner_rule')]"/>
</function>
<value eval="{'noupdate': False}"/>
</function>

<record model="ir.rule" id="base.res_partner_rule">
<field name="name">res.partner company</field>
<field name="model_id" ref="base.model_res_partner"/>
<!--
Show partners from ancestors and descendants companies
(or company-less), this is usually a better default for
multicompany setups.
-->
<field name="domain_force"> ['|',('company_id','=',user.company_id.id),('company_id','=',False)]</field>
<field name="active" eval="True"/>
</record>


<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'base'), ('name', '=', 'res_partner_rule')]"/>
</function>
<value eval="{'noupdate': True}"/>
</function>

Hope this helps!!

0
アバター

Niyas Raphy インド

--Niyas Raphy--
27417
| 7 7 11
Wayanad, Kerala, インド
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123
Whatsapp : +917736136763
Happy to help :)

Niyas Raphy インド
2019/04/13 5:02

Hi,

You can rewrite/overide exiting rule in your custom module and do necessary changes. What you have to do is that, just copy and paste the original rule in your module and change its ID like with original_module_name.ID


Suppose if the rule  is coming from the module purchase and if it's ID is test_rule , in your custom module change the ID of record to purchase.test_rule


Thanks

質問する
Writer
Keep Informed
1 フォロワー
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