如何隐藏product中的standard_price
- 
今天在尝试隐藏product中价格(分标价+成本价)中 
 发现,标价则直接用xpath定位到product_view.xml中的nomal_form视图即可,
 代码如下:
 <record id="product_expand_form_view_hidden_page" model="ir.ui.view">
 <field name="name">product_expand_form_view_hidden_page</field>
 <field name="model">product.product</field>
 <field name="inherit_id" ref="product.product_normal_form_view" />
 <field name="arch" type="xml">
 <xpath expr="/form/sheet/notebook/page[@string='Information']/group/group/field[@name='list_price']" position="attributes">
 <attribute name="groups" >product_expand.product_price_hidden</attribute>
 </xpath>
 </field>
 </record>
 而standard_price怎么也不成功
 与南京-ccdos 商讨N久后,终于发现
 该standard_price 字段,在stock中,有一个视图对其进行了replace重写
 所以我们追加的groups属性,继承的,应该是stock.view_product_standard_price_form
 视图如下:
 
 <record id="product_expand_hidden_price__page" model="ir.ui.view">
 <field name="name">product_expand_hidden_price_page</field>
 <field name="model">product.product</field>
 <field name="inherit_id" ref="stock.view_product_standard_price_form" />
 <field name="arch" type="xml">
 <field name="standard_price" position="attributes">
 <attribute name="groups" >product_expand.product_price_hidden</attribute>
 </field>
 </field>
 </record>
 测试成功
 注;product_expand.product_price_hidden是我新追加进一个组别
 另想请教一下,假如一个字段,原来已经有一个groups ,能否再attribute一个groups在里面,即,有两个groups
- 
南京-海飞(330472962) 22:23:01 
 可以试试看,或者直接replace 该字段。
 
 南京-ccdos(1431494) 22:24:24
 关键同时写 两个 groups
 南京-海飞(330472962) 22:25:12
 可以啊,很多例子,可写n个,只要你有。
 南京-ccdos(1431494) 22:25:28
 加逗号 ?
 上海-Jeff(85822082) 22:26:01
 是啊
 南京-海飞(330472962) 22:26:23
 <field name="product_uos_qty" groups="product.group_uos,base.group_extended"/> <field name="product_uos" groups="product.group_uos,base.group_extended"/>
 上海-Jeff(85822082) 22:26:33
 要不杂交gorups呢