Skip to Content
Menu
This question has been flagged
5 Replies
6610 Views

i want to add a filed in the form view of res_config_settings_view_form (pricisly right after po_order_approval field) i trid this code on the xml field 

 <record id="view_res_config_tech_inherit" model="ir.ui.view">
<field name="name">tech.config.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='app_settings_block']" position="before">
<div class="row mt16">
<field name="first_ki"/>
</div>
        </xpath>
</field>
</record>


and on my .py file 

 
class purchase(models.TransientModel):
_inherit = "res.config.settings"

first_ki = fields.Monetary('Ki')


but i stiil can't displaying the field

Avatar
Discard
Author

thanks for replay @Arun but the field still dosent shows up

Author

thanks @Paresh, but it seems that i was trigering on the rong external_id, i change

<field name="inherit_id" ref="purchase.res_config_settings_view_form_purchase"/>

and it works now

Best Answer

Try changing the name of the class to ResConfigSettings and add the get_values and set_values methods to the class, as required.

Here's an example:

https://github.com/odoo/odoo/blob/13.0/addons/hr_expense/models/res_config_settings.py#L6

Avatar
Discard
Best Answer

res.config.settings to add field and save data. Required to set and get value or default method value pass. Based on odoo version will vary. See the below link.

https://www.odoo.com/forum/help-1/question/problems-on-saving-data-to-res-config-settings-in-odoo-12-153308

https://odoo-development.readthedocs.io/en/latest/dev/py/res.config.settings.html

Avatar
Discard
Best Answer

I believe you'd need to add the "action_window" that set's up your module as the context and link's it to your view. Something like this...

     <record id="custom_purchase_module_settings_action" model="ir.actions.act_window">

        <field name="name">Settings</field>

        <field name="type">ir.actions.act_window</field>

        <field name="res_model">res.config.settings</field>

        <field name="view_id" ref="view_res_config_tech_inherit"/>

        <field name="view_mode">form</field>

        <field name="target">inline</field>

        <field name="context">{'module' : 'my_custom_purchase_module'}</field>

    </record>

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 25
2726
0
May 23
2420
3
Mar 25
24329
1
Nov 22
2353
1
May 22
5840