Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
5 ตอบกลับ
6608 มุมมอง

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>

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 25
2726
0
พ.ค. 23
2420
3
มี.ค. 25
24329
I can't upload any file in Odoo 13 แก้ไขแล้ว
1
พ.ย. 22
2352
1
พ.ค. 22
5840