Tagged: color

Odoo Widget 颜色的使用

Tree视图定义行的颜色

<record id="purchase_order_tree" model="ir.ui.view">
	<field name="name">purchase.order.tree</field>
	<field name="model">purchase.order</field>
	<field name="arch" type="xml">
		<tree decoration-bf="message_unread==True" decoration-muted="state=='cancel'" decoration-info="state in ('wait','confirmed')" string="Purchase Order">
			<field name="message_unread" invisible="1"/>
			<field name="name" string="Reference"/>
			<field name="date_order" />
			<field name="partner_id"/>
			<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
			<field name="date_planned" invisible="context.get('quotation_only', False)"/>
			<field name="origin"/>
			<field name="amount_untaxed" sum="Total Untaxed amount" string="Untaxed" widget="monetary"/>
			<field name="amount_total" sum="Total amount" widget="monetary"/>
			<field name="currency_id" invisible="1"/>
			<field name="state"/>
			<field name="invoice_status" invisible="not context.get('show_purchase', True)"/>
		</tree>
	</field>
</record>

Kanban组件

color值为0~9

<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>

示例:

<record id="view_forum_post_kanban" model="ir.ui.view">
	<field name="name">forum.post.kanban</field>
	<field name="model">forum.post</field>
	<field name="arch" type="xml">
		<kanban default_group_by="documentation_stage_id" >
			<field name="documentation_stage_id"/>
			<field name="create_uid"/>
			<field name="color"/>
			<templates>
			<t t-name="kanban-box">
				<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
					<div class="o_dropdown_kanban dropdown" groups="base.group_user">
						<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
							<li t-if="widget.editable"><a type="edit">Edit Post</a></li>
							<li t-if="widget.deletable"><a type="delete">Delete</a></li>
							<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
						</ul>
					</div>
				</div>
			</t>
			</templates>
		</kanban>
	</field>
</record>

Many2many_tag widget

值范围:1~12

<field name="about_place_route" widget="many2many_tags" options="{'color_field': 'color', 'no_open':True,'no_create':1,'no_create_edit':1}" />


啊啊