Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I need your help please.
I try to set a value of group_invoice_so_lines to true in sale.config.settings using a custom module. In xml file i've added this code:
<?xml version="1.0" encoding="utf-8"?>
<function model="res.config.settings" name="set_default">
but the field value is alaways set to False.
Any idea ? how can I create a module to activate all features that I need.
The Model is a transientModel so you can not store data in xml.
But how to do what happends by clicking options:
look in 'openerp.addons.base.res.res_config.res_config_settings#execute()'
- For a field like 'default_XXX', ``execute`` sets the (global) default value of the field 'XXX' in the model named by ``default_model`` to the field's value.
- For a boolean field like 'group_XXX', ``execute`` adds/removes 'implied_group' to/from the implied groups of 'group', depending on the field's value. By default 'group' is the group Employee. Groups are given by their xml id.
- For a boolean field like 'module_XXX', ``execute`` triggers the immediate installation of the module named 'XXX' if the field has value ``True``.
- For the other fields, the method ``execute`` invokes all methods with a name that starts with 'set_'; such methods can be defined to implement the effect of those fields.
So your solution would be:
<record model="res.groups" id="base.group_user"> <field name="implied_ids" eval="[(4, ref('sale.group_invoice_so_lines'))]"/> </record>
As you grep in code 'group_invoice_so_lines' that the on_change also changes the "default_order_policy" so you need also add this to your xml.
<function id="sale_order_order_pol_default_set" model="ir.values" name="set_default" eval="('sale.order','order_policy', 'manual')"/>
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
|Asked: 7/19/14, 9:06 PM|
|Seen: 2682 times|
|Last updated: 3/16/15, 8:10 AM|