Odoo中文网|Odoo实施培训

标题: tree视图中设置字体及颜色 [打印本页]

作者: 店小2    时间: 2015-10-31 22:46
标题: tree视图中设置字体及颜色
tree视图中根据一些条件设置具体的颜色 。例如:具体颜色取决于其状态。[attach]133[/attach]

  1. <tree string=”session List”

  2.                                 colors=”blue:state==’draft'; green:state==’confirmed’ “>

  3.                      <field name=”name”/>

  4.                      <field name=”start_date”/>

  5.                      <field name=”end_date”/>

  6.                      <field name=”duration”/>

  7.                      <field name=”seats”/>

  8.                      <field name=”instructor_id”/>

  9.                      <field name=”course_id”/>

  10.                      <field name=”attendee_count”/>

  11.                      <field name=”state” />

  12.                      <field name=”taken_seats” widget=”progressbar”/>

  13.                  </tree>
复制代码
不要忘记,字段列表中各条件的属性的设置 ,其中就包含颜色属性。
  1. If state in either ‘confirmed’, ‘done’, ‘waiting’ :

  2. colors=”blue: state in (‘confirmed’, ‘done’, ‘waiting’)”
  3. if state is equal to ‘draft’:

  4. colors=”blue: state==’draft’ “
  5. if duration is greater than 5:         

  6. colors=”blue: duration > 5 “
  7. if duration is less than 15:  

  8. colors=”blue: duration < 15 “
  9. multiple conditions:

  10. colors=”blue: state in (‘confirmed’, ‘done’, ‘waiting’) ; red: state==’draft’”
复制代码
字体
  我们也可以通过设置属性的方式,进行字体的设置。例如





欢迎光临 Odoo中文网|Odoo实施培训 (http://www.chinaodoo.net/) Powered by Discuz! X3.2