【问题标题】:Change sale module view, treestrings, names, button names更改销售模块视图、树字符串、名称、按钮名称
【发布时间】:2013-12-04 05:38:32
【问题描述】:

例如,我需要更改 openerp's 的 treeview sale 模块,只需更改 quotation 和 sale order 的 tree strings 和 sale order

为此,我正在制作一个全新的模块(init _openerp_ 和 view.xml 文件)

我将继承view 然后用xpath 覆盖名称问题是,我仍然无法完成它,它给了我一个

ERROR:RELAXNGV:RELAXNG_ERR_ELEMWRONG: Did not expect element record there

我的代码是:

<record id="view_quotation_tree" model="ir.ui.view" >
<field name="name">sale.order.tree.inherit</field>
<field name="model">sale.order</field>
<field name="type">tree</field>
<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml">
 <xpath expr="//tree[@string='Quotation']" position="replace">
    <tree string="Servicios" fonts="bold:message_unread==True" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
    </tree>
 </xpath>
</field>

任何帮助将不胜感激,

提前致谢!

编辑:

例如,我需要将标题Quotation 更改为Solicitud de Servicios,或将Sale Order 更改为Compra de Servicios。

【问题讨论】:

    标签: python xml xpath view openerp


    【解决方案1】:

    使用,

    <record id="view_quotation_tree" model="ir.ui.view" >
    <field name="name">sale.order.tree.inherit</field>
    <field name="model">sale.order</field>
    <field name="type">tree</field>
    <field name="inherit_id" ref="sale.view_quotation_tree"/>
    <field name="arch" type="xml">
     <xpath expr="//tree[@string='Quotation']" position="attributes">
        <attribute name="string">Servicios</attribute>
    </xpath>
    </field>
    

    【讨论】:

      【解决方案2】:

      不要替换 tree.try position='attributes'

      <xpath expr="/tree[@string='Quotation']" position="attributes">
          <attribute name="string">Servicios</attribute>
      </xpath>
      

      【讨论】:

      • 谢谢你们,但它在模型“sale.order”上显示“AttributeError:继承视图的视图定义错误”:元素“' not found in parent view 'sale.view_quotation_tree'' 它实际上出现在那里 =/
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多