تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
5 الردود
6613 أدوات العرض

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

الصورة الرمزية
إهمال
الكاتب

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

الكاتب

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

أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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>

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يوليو 25
2726
0
مايو 23
2420
3
مارس 25
24329
1
نوفمبر 22
2353
1
مايو 22
5840