首页 > 解决方案 > 另一个odoo的一个视图中的基本属性

问题描述

我在设置中创建了一个名为“paper_prescriptions_exempt_forms_pres”的字段:

paper_prescriptions_exempt_forms_pres = fields.Boolean(
        string="Paper Prescriptions Exempt Forms Visible")
<?xml version="1.0" encoding="UTF-8"?>
<odoo>


   <record id="res_config_settings_view_form" model="ir.ui.view">
        <field name="name">res.config.settings.view.form.inherit.sale</field>
        <field name="model">res.config.settings</field>
        <field name="priority" eval="10"/>
        <field name="inherit_id" ref="base.res_config_settings_view_form" />
        <field name="arch" type="xml">
            <xpath expr="//div[hasclass('settings')]" position="inside">
               <div class="app_settings_block" data-string="Prescriptions" string="Prescriptions" data-key="Prescriptions">
                    <h2>Prescriptions</h2>
                      <div class="row mt16 o_settings_container">
                          <div class="o_setting_left_pane">
                           <label for="paper_prescriptions_exempt_forms_pres" string="Visible"/> 
                           <field name='paper_prescriptions_exempt_forms_pres'/>
                          </div>
                      </div>          
                </div>
            </xpath>
        </field>
    </record>

并希望在不同的表单视图中将其称为属性:

<?xml version="1.0" encoding="UTF-8"?>
<odoo>

    <record id="prescriptions_form" model="ir.ui.view">
            <field name="name">prescriptions.prescriptions.form</field>
            <field name="model">prescriptions.prescriptions</field>
            <field name="arch" type="xml">
              <form sting='prescriptions'>
                <group col ='4' style="margin-left:50px;">
                  <group>
                    <field name="name" style="font-size:42px"/>
                    <field name="date_entered_by_user"/>
                  <group string='Paper Prescriptions'>
                    <group string='Forms'>
                      <field name="paper_prescriptions_exempt_forms" attrs="{'invisible': [('paper_prescriptions_exempt_forms_pres','=',False)]}"/>

但我收到以下错误:

属性中使用的字段 'paper_prescriptions_exempt_forms_pres' 必须存在于视图中,但缺少: - attrs="{'invisible': [('paper_prescriptions_exempt_forms_pres','=',False)]} 中的'paper_prescriptions_exempt_forms_pres'

任何有关如何正确执行此操作的建议将不胜感激!

标签: python-3.xxmlodooodoo-12

解决方案


推荐阅读