如何在odoo 9中更改float字段的text-align

时间:2016-09-24 22:52:43

标签: python css xml openerp

我在我的模型中有一个浮动字段,当我将其放在窗体视图中时会保持对齐状态。我的问题是如何将其更改为正确对齐。

我已经尝试了很多方法来改变它的右对齐但失败了。我尝试添加class="oe_right",创建css自定义模块但无法正常工作。请帮帮我

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以通过在特定字段中提供内嵌样式来设置右对齐文本。请尝试以下代码。

<强> 1。右侧对齐Float字段

<field name="field_name" style="text-align:right;"/>

<强> 2。在编辑模式下右对齐浮点字段值

您需要创建自定义css

档案 base.css

.openerp .oe_form_editable .oe_form .oe_form_field_float input{
text-align: right !important;}

将css添加到assets_common

   <template id="assets_common_float_inherited" inherit_id="web.assets_common">
        <xpath expr="." position="inside">
            <link rel="stylesheet" href='/your_module_name/static/src/css/base.css'/>
        </xpath>
    </template>

将xml文件添加到 __ openerp __。py

感谢。