odoo12-继承视图

search视图

<record id="od_mrp_bom_filter" model="ir.ui.view">
   <field name="name">mrp.bom.search</field>
   <field name="model">mrp.bom</field>
   <field name="inherit_id" ref="mrp.view_mrp_bom_filter"/>
   <field name="arch" type="xml">
       <xpath expr="//filter[@name='product']"  position="after">
            <filter string="模具序列" name="group_by_product_series" context="{'group_by':'product_series'}"/>
       </xpath>
   </field>
</record>

<record id="mrp.mrp_bom_form_action" model="ir.actions.act_window">
    <field name="name">Mrp Bom Product Series</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">mrp.bom</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    <field name="view_id" eval="False"/>
    <field name="limit">200</field>
    <field name="search_view_id" ref="mould_bom.od_mrp_bom_filter"/>
    <field name="context">{'search_default_group_by_product_series':1}</field>
</record>
  • 这里的id=“mrp.mrp_bom_form_action”,mrp指的是模块,mrp_bom_form_action指的源码里面定义的id 源码如下:
<record id="mrp_bom_form_action" model="ir.actions.act_window">
    <field name="name">Bills of Materials</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">mrp.bom</field>
    <field name="domain">[]</field> <!-- force empty -->
    <field name="view_type">form</field>
    <field name="view_mode">tree,kanban,form</field>
    <field name="search_view_id" ref="view_mrp_bom_filter"/>
    <field name="help" type="html">
      <p class="o_view_nocontent_smiling_face">
        Create a bill of materials
      </p><p>
        Bills of materials allow you to define the list of required raw
        materials used to make a finished product; through a manufacturing
        order or a pack of products.
      </p>
    </field>
</record>

tree视图

<record id="mrp_bom__view_tree_inherit_plm" model="ir.ui.view">
  <field name="name">mrp.bom.view.frame.tree.inherit.plm</field>
  <field name="model">mrp.bom</field>
  <field name="inherit_id" ref="mrp.mrp_bom_tree_view"/>
  <field name="arch" type="xml">
      <xpath expr="//field[@name='code']" position="after">
          <field name="sale_id"/>
      </xpath>
      <xpath expr="//field[@name='product_tmpl_id']" position="before">
          <field name="product_series"/>
      </xpath>
      <xpath expr="//field[@name='product_tmpl_id']" position="attributes">
          <attribute name="string">模具序号</attribute>
      </xpath>
  </field>
</record>

form视图

<record id="dd_mould_sale_order_add_base_line_form_view" model="ir.ui.view">
    <field name="name">od.sale.order.form.inherit</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
        <field name="partner_no" position="after">
            <field name="product_series" required="1"/>
            <field name="process_state"/>
        </field>
        <xpath expr="//header" position="inside">
            <button name="transfer_to_bom" string="转物料清单" type="object"/>
        </xpath>
        <xpath expr="//page[1]" position="attributes">
            <attribute name="attrs">{'invisible': [('process_state', 'not in', ('done'))]}</attribute>
        </xpath>
        <xpath expr="//page[1]/field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
            <attribute name="attrs">{'required': [('parent.state', 'not in', ('draft'))]}
            </attribute>
            <attribute name="string">产品名称</attribute>
        </xpath>
        <xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="before">
            <field name="project_name"/>
        </xpath>
        <xpath expr="//page[1]" position="before">
            <page string="订单行" attrs="{'invisible': [('process_state', 'in', ('done'))]}">
                <button name="create_sale_orders" string="生成销售明细" type="object"/>
                <field name="base_lines">
                    <tree editable="bottom">
                        <field name="sequence" widget="handle"/>
                        <field name="compute_sequence" invisible="1"/>
                        <field name="sequence_num" readonly="1" force_save="1"/>
                        <field name="project_name"/>
                        <field name="product_name"/>
                        <field name="product_image" widget="image_thumbnail" class="text-center"
                               options='{"preview_image": "image_medium", "size": [50, 50]}'/>
                        <field name="product_no"/>
                        <field name="product_material"/>
                        <field name="cavity_number" class="oe_edit_only" column_invisible_inisedit="0"/>
                        <field name="total_num" class="oe_read_only" column_invisible_inisedit="1"/>
                        <field name="serial_number" required="1"/>
                        <field name="date_planned" invisible="1"/>
                        <field name="product_uom_qty"/>
                        <field name="product_uom" required="1"/>
                        <field name="product_sub_qty" invisible="1"/>
                        <field name="product_sub_uom" invisible="1"/>
                        <field name="tax_id" options="{'no_create': True}"
                               domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"/>
                        <field name="price_unit"/>
                        <field name="price_total" readonly="1" force_save="1"/>
                        <field name="price_subtotal" readonly="1" force_save="1" invisible="1"/>
                        <field name="row_merge_desc" invisible="1"/>
                        <button name="copy_base_line" string="复制" type="object"/>
                    </tree>
                </field>
                <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total">
                    <field name="base_untax_money" string="未税金额" readonly="1" force_save="1"/>
                    <field name="base_tax_money" string="税额" readonly="1" force_save="1"/>
                    <div class="oe_subtotal_footer_separator oe_inline o_td_label">
                        <label for="base_total_money" string="总计"/>
                    </div>
                    <field name="base_total_money" nolabel="1" class="oe_subtotal_footer_separator" readonly="1"
                           force_save="1"/>
                </group>
            </page>
        </xpath>
    </field>
</record>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值