python-3.x - 另一个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'
任何有关如何正确执行此操作的建议将不胜感激!
解决方案
推荐阅读
- google-apps-script - 在谷歌表格中使用过滤器/查询时自动 S# 列
- django - Viewset/Serializer 上的 DRF PUT 不会在模型实例上触发 post_save 信号
- java - 我怎样才能在 Selenide 上做这个方法
- excel - Powershell 数据处理
- regex - 我想通过更改特定位置的一个字符来批量编辑数百个文件
- python - postman 中的 Runner 集合与 Python 代码之间的关系
- php - Symfony 5 获取 @ParamConverter 注释未找到的失败对象
- ruby-on-rails - Rails 从 start_date 和 end_date 计算日期持续时间
- r - Rcpp 函数导致包崩溃
- python - selenium,python - 无论我将延迟设置为什么,WebDriverWait 都会有 60% 的时间超时