I'm trying to store config data in odoo, I need to store 3 reference to 'account.journal'. The model is created in database, the view is shown in configuration base menu, the data is store in database when I push the APPLY button BUT when I reload the menu the data is not shown
The code use:
from openerp import fields, models, osv, api, _
class Configuration(models.TransientModel):
_inherit = 'res.config.settings'
_name = 'transporte_carta_de_porte.config.settings'
ft_mercaderia = fields.Many2one(
'account.journal',string='Debito ft mercaderia',
help="Diario de ajuste al transportista por faltante de mercaderia")
ade_transportista = fields.Many2one(
'account.journal',string='Debito por adelanto transportista',
help="Diario de debito al transportista por faltante de adelanto")
ade_proveedor = fields.Many2one(
'account.journal',string='Debito por adelanto proveedor',
help="Diario de debito por adelanto en la cuenta del proveedor de combustible",)
The layout
<record id="view_tcp_config_settings" model="ir.ui.view">
<field name="name">TCP settings</field>
<field name="model">transporte_carta_de_porte.config.settings</field>
<field name="arch" type="xml">
<form string="TCP settings" class="oe_form_configuration">
<sheet>
<div>
<button string="Apply" type="object" name="execute" class="oe_highlight" />
or
<button string="Cancel" type="object" name="cancel" class="oe_link" />
</div>
<group string="Journals Settings">
<field name="ft_mercaderia" />
<field name="ade_transportista" />
<field name="ade_proveedor" />
</group>
</sheet>
</form>
</field>
</record>
<record id="action_tcp_configuration" model="ir.actions.act_window">
<field name="name">TCP Configuration</field>
<field name="res_model">transporte_carta_de_porte.config.settings</field>
<field name="priority" eval="50" />
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<menuitem id="menu_tcp_config" name="TCP Settings" parent="base.menu_config" action="action_tcp_configuration" />
Every time I choose a value for the fields and push Apply a new record is created insted of modify the first created and no one is load on the view load. Thanks for reading!