我正在尝试将配置数据存储在 odoo 中,我需要存储 3 个对“account.journal”的引用。模型在数据库中创建,视图显示在配置基本菜单中,当我按下应用按钮时数据存储在数据库中但是当我重新加载菜单时数据未显示
代码使用:
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",)
布局
<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" />
每次我为字段选择一个值并推送应用时,都会创建一个新记录,以修改第一个创建的记录,并且没有人加载视图负载。谢谢阅读!