acc_purchase_view.xml 21.0 KB
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="purchase_order_form_inherit" model="ir.ui.view">
            <field name="name">purchase.order.form.inherit</field>
            <field name="model">purchase.order</field>
            <field name="inherit_id" ref="purchase.purchase_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//button[@name='action_rfq_send'][1]" position="attributes">
                    <attribute name="invisible">1</attribute>   
                </xpath>
                <xpath expr="//button[@name='action_rfq_send'][2]" position="attributes">
                    <attribute name="invisible">1</attribute>   
                </xpath>
                <xpath expr="//button[@name='action_rfq_send'][3]" position="attributes">
                    <attribute name="invisible">1</attribute>   
                </xpath>
                <xpath expr="//button[@name='print_quotation'][1]" position="attributes">
                    <attribute name="invisible">1</attribute>   
                </xpath>
                <xpath expr="//button[@name='print_quotation'][2]" position="attributes">
                    <attribute name="invisible">1</attribute>   
                </xpath>
                <xpath expr="//button[@name='button_confirm'][1]" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//button[@name='button_confirm'][2]" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <!-- <xpath expr="//button[@name='action_view_invoice'][1]" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//button[@name='action_view_invoice'][2]" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath> -->
                <xpath expr="//button[@name='action_view_invoice'][2]" position="after">
                    <!-- <button name="export_purchase_record" string="导出询价单信息" type="object" states="draft" class="oe_highlight" groups="base.group_user"/> -->
                    <button name="export_purchase_record" string="导出物料信息" type="object" class="oe_highlight" states="draft,confirm,purchase" groups="base.group_user"/>
                    <button name="%(purchase_separate_wizard)d" type="action" states="purchase" string="分批账单" class="oe_highlight" groups="purchase.group_purchase_user"/>
                    <button name="update_newinfo" string="更新产品信息" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
                    <button name="fresh_merge_line" string="合并重复产品" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
                    <button name="check_before_qty" string="数量校对" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
                    <button name="confirm" string="提交审批" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
                    <button name="pomanager" string="采购经理审批" type="object" states="confirm" class="oe_highlight" groups="acct_base.acc_commerce_manager_group"/>
                    <button name="boss_accept" string="管理部审批" type="object" states="pomanager" class="oe_highlight" groups="acct_base.acc_manage_info_group"/>

                    <button name="button_draft" string="拒绝" type="object" states="confirm" class="oe_highlight" groups="acct_base.acc_commerce_manager_group"/>
                    <button name="button_draft" string="拒绝" type="object" states="pomanager" class="oe_highlight" groups="acct_base.acc_manage_info_group"/>
                    <button name="button_draft" string="取消" type="object" states="confirm,pomanager" class="oe_highlight" groups="base.group_user"/>
                    <button name="button_approve" string="确认订单" type="object" class="oe_highlight" attrs="{'invisible': [('state', 'not in', ['boss'])]}" groups="acct_base.acc_commerce_manager_group"/>   
                </xpath>
                <xpath expr="//field[@name='state']" position="attributes">
                    <attribute name="statusbar_visible">draft,confirm,pomanager,boss,purchase</attribute>
                </xpath>
                <!-- <button name="print_quotation" string="Print RFQ" type="object" states="draft" class="oe_highlight" groups="base.group_user"/> -->
                <xpath expr="//field[@name='partner_ref']" position="after" >
                    <field name="contact_id" context="{'choose_contact':'choose_contact','partner_id':partner_id}"/>
                    <field name="title"/>
                    <!-- <button class="oe_stat_button" name="export_purchase_record" string="导出" type="object"/> -->
                    <field name="charge_person"/>
                    <field name="traffic_rule"/>
                    <field name="delivery_time" placeholder="填写格式如(1-2周,1-2weeks,1-2天,1-2days)"/>
                    <field name="product_state"/>
                    <field name="payment_state"/>
                    <field name="paid_rate"/>
                    <field name="delivery_address"/>
                    <field name="picking_type_id"/>
                    <field name="merge_info"/>
                </xpath>
                <xpath expr="//field[@name='date_order']" position="after" >
                    <field name="crm_ponumber"/>
                    <field name="purchase_way"/>
                    <field name="purchase_type"/>
                    <field name="purchase_company" options="{'no_create': True, 'no_open': True}"/>
                    <field name="quality_state"/>
                    <field name="payment_rule"/>
                    <field name="end_date"/>
                    <field name="forcast_date"/>
                    <field name="demand_purchase"/>
                    <field name="before_purchase_id"/>
                    <field name="origin_order"/>
                    <field name="is_excipients"/>
                    <field name="en_name" invisible='1'/>
                    <field name="ship_fee"/>
                    <!-- <field name="discount_amount"/> -->
                    <field name="discount_type"/>
                    <!-- <font attrs="{'invisible': ['|', ('discount_type', '!=', 'discount')]}" style="line-height:34px;">折扣比例:</font> -->
                    <field name="discount_rate" attrs="{'invisible': ['|', ('discount_type', '!=', 'discount')],'required':[('discount_type', '=', 'discount')]}" style="width:18%"/>
                    <field name="minus_amount" attrs="{'invisible': ['|', ('discount_type', '!=', 'minusprice')],'required':[('discount_type', '=', 'minusprice')]}" style="width:18%;"/>
                </xpath>
                <xpath expr="//field[@name='amount_tax']" position="after" >
                    <field name="discount_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
                </xpath>
                <!-- <xpath expr="/form/sheet/notebook/page[@name='purchase_delivery_invoice']" position="after">
                    <page string="付款记录">
                        <field name="purchase_payrecord_line">
                            <tree string="付款记录" editable="bottom">
                                <field name="pay_amount"/>
                                <field name="pay_datetime"/>                           
                                <field name="pay_user"/>
                            </tree>
                        </field>
                    </page>
                </xpath> -->
            </field>
        </record>

        <record id="purchase_order_tree_inherit" model="ir.ui.view">
            <field name="name">purchase.order.tree.inherit</field>
            <field name="model">purchase.order</field>
            <field name="inherit_id" ref="purchase.purchase_order_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='name']" position="after" >
                    <field name="title"/>
                    <field name="product_state"/>
                    <field name="payment_state"/>
                    <field name="forcast_date"/>
                    <field name="purchase_way" invisible='1'/>   
                </xpath>
                <xpath expr="//field[@name='date_planned']" position="attributes" >
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//field[@name='user_id']" position="attributes" >
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//field[@name='origin']" position="attributes" >
                    <attribute name="invisible">1</attribute>
                </xpath>
            </field>
        </record>

        <!-- 采购单增加搜索条件视图 -->
        <record id="acc_purchase_order_search_view" model="ir.ui.view">
            <field name="name">acc.purchase.order.search</field>
            <field name="model">purchase.order</field>
            <field name="mode">primary</field>
            <field name="inherit_id" ref="purchase.view_purchase_order_filter"/>
            <field name="arch" type="xml">
                <xpath expr="//filter[@name='activities_my']" position="after">
                    <separator/>
                    <field name="title" string="标题" filter_domain="[('title','ilike',self)]"/>
                    <field name="charge_person" string="负责人"/>
                    <field name="origin_order" string="项目号(源销售单)"/>
                    <field name="before_purchase_id" string="源待确认询价单"/>
                    <field name="order_line" string="产品编码" filter_domain="[('order_line.product_id.acc_code', 'ilike', self)]"/>
                    <separator/>
                    <filter name="product_state" string="未到货" domain="[('product_state','=', 'new')]"/>
                    <filter name="product_state" string="部分到货" domain="[('product_state','=', 'part')]"/>
                    <filter name="product_state" string="全部到货" domain="[('product_state','=', 'all')]"/>
                    <filter name="product_state" string="取消订单" domain="[('product_state','=', 'cancel')]"/>
                    <filter name="payment_state" string="部分已付" domain="[('payment_state','=', 'part_pay')]"/>
                    <filter name="payment_state" string="未付" domain="[('payment_state','=', 'nopay')]"/>
                    <filter name="payment_state" string="全部付清" domain="[('payment_state','=', 'allpay')]"/>
                </xpath>
            </field>
        </record>

        <record id="acc_purchase_rfq" model="ir.actions.act_window">
            <field name="name">询价单</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">purchase.order</field>
            <field name="view_mode">tree,kanban,form,pivot,graph,calendar,activity</field>
            <field name="search_view_id" ref="acc_purchase_order_search_view"/>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Create a request for quotation
              </p><p>
                The quotation contains the history of the discussion
                you had with your vendor.
              </p>
            </field>
        </record>

        <record id="wait_acc_purchase_pomanger1" model="ir.actions.act_window">
            <field name="name">待采购经理审批采购单</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">purchase.order</field>
            <field name="view_mode">tree,kanban,form,pivot,graph,calendar,activity</field>
            <field name="search_view_id" ref="acc_purchase_order_search_view"/>
            <field name="domain">[('state','=','confirm')]</field>
        </record>

        <record id="wait_acc_purchase_boss1" model="ir.actions.act_window">
            <field name="name">待管理部审批采购单</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">purchase.order</field>
            <field name="view_mode">tree,kanban,form,pivot,graph,calendar,activity</field>
            <field name="search_view_id" ref="acc_purchase_order_search_view"/>
            <field name="domain">[('state','=','pomanager')]</field>
        </record>

        <record id="wait_acc_purchase_manager1" model="ir.actions.act_window">
            <field name="name">待确认采购单</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">purchase.order</field>
            <field name="view_mode">tree,kanban,form,pivot,graph,calendar,activity</field>
            <field name="search_view_id" ref="acc_purchase_order_search_view"/>
            <field name="domain">[('state','=','boss')]</field>
        </record>

        <!-- <menuitem action="purchase_rfq" id="menu_purchase_rfq"
            parent="purchase.menu_procurement_management"
            sequence="0"/> -->

        <menuitem id="menu_acc_purchase_rfq" name="询价单" parent="purchase.menu_procurement_management" action="acc_purchase_rfq" sequence="1"/>

        <menuitem id="menu_wait_acc_purchase_pomanager1" name="已提交采购单" parent="purchase.menu_procurement_management" action="wait_acc_purchase_pomanger1" sequence="1"/>

        <menuitem id="menu_wait_acc_purchase_boss1" name="需管理部审核采购单" parent="purchase.menu_procurement_management" action="wait_acc_purchase_boss1" sequence="1"/>

        <menuitem id="menu_wait_acc_purchase_queren1" name="待确认采购单" parent="purchase.menu_procurement_management" action="wait_acc_purchase_manager1" sequence="1"/>

        <record id="acc_purchase_form_action" model="ir.actions.act_window">
            <field name="name">采购订单</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">purchase.order</field>
            <field name="view_mode">tree,kanban,form,pivot,graph,calendar,activity</field>
            <field name="domain">[('state','in',('purchase', 'done'))]</field>
            <field name="search_view_id" ref="acc_purchase_order_search_view"/>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Create a quotation
              </p><p>
                It will be converted into a purchase order.
              </p>
            </field>
        </record>

        <menuitem id="menu_acc_purchase_form_action" name="采购订单" parent="purchase.menu_procurement_management" action="acc_purchase_form_action" sequence="2"/>

        <!--purchase模块-->
        <record id="purchase_acc_form_view" model="ir.ui.view">
            <field name="name">purchase.acc.form</field>
            <field name="model">purchase.order</field>
            <field name="inherit_id" ref="purchase.purchase_order_form"/>
            <field name="arch" type="xml">
                    <!-- <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='product_id']" position="attributes">
                        <attribute name="string">名称</attribute>
                    </xpath> --> 
                    <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='name']" position="attributes">
                        <attribute name="string">规格型号</attribute>
                    </xpath>
                    <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='name']" position="after">
                        <field name="acc_code"/>
                        <field name="partner_code"/>
                        <field name="forcast_date"/>
                        <!-- <field name="f_date"/> -->
                    </xpath>
                    <!-- <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='product_uom']" position="attributes">
                        <attribute name="string">单位</attribute>
                    </xpath> -->
                    <xpath expr="//field[@name='date_planned']" position="attributes">
                        <attribute name="invisible">1</attribute>
                    </xpath> 
                    <xpath expr="/form/sheet/notebook/page/field/tree/field[@name='company_id']" position="attributes">
                        <attribute name="invisible">1</attribute>
                    </xpath> 
                    <!-- <xpath expr="//field[@name='account_analytic_id']" position="attributes">
                        <attribute name="invisible">1</attribute>
                    </xpath>  -->
            </field>
        </record>

        <!-- 刷新采购单付款到货状态定时任务 -->
        <data noupdate="1">
            <record id="ir_cron_acc_fresh_po_state" model="ir.cron">
                <field name="name">更新采购单付款到货状态</field>
                <field name="interval_number">1</field>
                <field name="interval_type">days</field>
                <field name="numbercall">-1</field>
                <field name="model_id" ref="model_purchase_order"/>
                <field name="code">model._fresh_po_state()</field>
                <field name="state">code</field>
                <field eval="True" name="doall"/>
                <!-- <field eval="'excipients.product'" name="model"/> -->
                <!-- <field eval="'_check_need_purchase'" name="function"/> -->
                <field eval="0" name="priority"/>
                <field name="active" eval="True"/>
            </record>
        </data>

        <!-- product.template搜索视图 -->
        <!-- <record id="acc_product_template_search_view" model="ir.ui.view">
            <field name="name">acc.product.template.search</field>
            <field name="model">product.template</field>
            <field name="mode">primary</field>
            <field name="inherit_id" ref="product.product_template_search_view"/>
            <field name="arch" type="xml">
                <xpath expr="//filter[@name='inactive']" position="after">
                    <separator/>
                    <field name="brand" string="品牌" filter_domain="[('brand','ilike',self)]"/>
                    <field name="partner_id" string="供应商"/>
                    <field name="product_model" string="产品型号" filter_domain="[('product_model','ilike',self)]"/>
                </xpath>
            </field>
        </record>

        <record id="product_acc_action_puchased" model="ir.actions.act_window">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.template</field>
            <field name="view_type">form</field>
            <field name="view_mode">kanban,tree,form,activity</field>
            <field name="context">{"search_default_filter_to_purchase":1, "purchase_product_template": 1}</field>
            <field name="search_view_id" ref="acc_product_template_search_view"/>
            <field name="view_id" eval="False"/>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Create a new product
              </p><p>
                You must define a product for everything you purchase,
                whether it's a physical product, a consumable or services.
              </p>
            </field>
        </record>

        <menuitem id="menu_purchase_acc_product_template" name="产品" parent="purchase.menu_procurement_management" action="product_acc_action_puchased" groups="purchase.group_purchase_user" sequence="100"/> -->



        <record id="action_purchase_partner_other_form" model="ir.actions.act_window">
            <field name="name">contacts</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.partner</field>
            <field name="view_type">form</field>
            <field name="view_mode">kanban,tree,form</field>
            <!-- <field name="domain">[('supplier','!=',1),('customer','!=',1),('is_company','!=',1)]</field>
            <field name="context">{'default_customer':0, 'default_customer':0, 'default_is_company': False, 'search_default_is_company':False,}</field> -->
            <field name="domain">[('is_company','!=',1)]</field>
            <field name="context">{'default_is_company': False, 'search_default_is_company':False,}</field>
            <field name="filter" eval="True"/>
        </record>

        <!-- <menuitem id="menu_purchase_other_management" name="其他信息"
            parent="purchase.menu_purchase_root" sequence="3" />

        <menuitem id="menu_purchase_uom_form_action" name="计量单位" parent="menu_purchase_other_management" action="uom.product_uom_form_action" groups="purchase.group_purchase_user" sequence="50"/>

        <menuitem id="menu_purchase_partner_other_form" name="联系人" parent="menu_purchase_other_management" action="action_purchase_partner_other_form" groups="purchase.group_purchase_user" sequence="49"/> -->

    </data>
</openerp>