Files
test/sf_sale/views/purchase_order_view.xml
2025-02-19 11:31:46 +08:00

357 lines
22 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record model="ir.ui.view" id="view_purchase_order_form_inherit_sf">
<field name="name">purchase.order.form.inherit.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//header/button[@name='action_view_picking']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//header/button[@name='button_confirm']" position="replace">
</xpath>
<xpath expr="//header/button[@name='button_confirm']" position="replace">
</xpath>
<xpath expr="//header/button[@name='action_rfq_send'][1]" position="before">
<button name="button_confirm" type="object" string="确认订单"
context="{'validate_analytic': True}" class="oe_highlight" id="draft_confirm"
groups="sf_base.group_purchase,sf_base.group_purchase_director"
attrs="{'invisible': [('state', 'in', ['purchase', 'done', 'cancel'])]}"
/>
<button name="action_view_picking"
string="接收产品" class="oe_highlight" type="object"
attrs="{'invisible': ['|', '|' , ('is_shipped', '=', True), ('state','not in', ('purchase','done')), ('incoming_picking_count', '=', 0)]}"
data-hotkey="y" groups="stock.group_stock_user"/>
<button name="button_cancel" states="draft,to approve,sent,purchase" string="取消" type="object"
data-hotkey="x"/>
</xpath>
<xpath expr="//header/button[@name='button_cancel'][2]" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='user_id']" position="attributes">
<attribute name="string">采购员</attribute>
</xpath>
<xpath expr="//field[@name='origin']" position="attributes">
<attribute name="string">源单据</attribute>
</xpath>
<field name="partner_id" position="replace">
<field name="partner_id" widget="res_partner_many2one" context="{'is_supplier': True }"/>
</field>
<field name="currency_id" position="after">
<field name="remark" attrs="{'readonly': [('state', 'in', ['purchase'])]}" string="订单备注"/>
</field>
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="replace">
<button name="action_rfq_send" states="draft" string="通过Email发送采购单" type="object"
context="{'send_rfq':True}" class="oe_highlight" data-hotkey="g"
groups="sf_base.group_purchase,sf_base.group_purchase_director"/>
</xpath>
<xpath expr="//form/header/button[@name='action_rfq_send'][2]" position="replace">
<button name="action_rfq_send" states="sent" string="通过Email重新发送采购单" type="object"
context="{'send_rfq':True}" data-hotkey="g"
groups="sf_base.group_purchase,sf_base.group_purchase_director"/>
</xpath>
<xpath expr="//form/header/button[@name='action_rfq_send'][3]" position="replace">
<button name="action_rfq_send" states="purchase" string="通过Email发送订单" type="object"
context="{'send_rfq':False}" data-hotkey="g"
groups="sf_base.group_purchase,sf_base.group_purchase_director"/>
</xpath>
<!-- <xpath expr="//form/header/button[@name='print_quotation[1]']" position="attributes">-->
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//form/header/button[@name='print_quotation[2]']" position="attributes">-->
<!-- <attribute name="groups">sf_base.group_purchase</attribute>-->
<!-- </xpath>-->
<xpath expr="//form/header/button[@name='button_approve']" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<xpath expr="//form/header/button[@name='action_create_invoice']" position="replace">
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute> -->
<button name="action_create_invoice" string="创建账单" type="object" class="oe_highlight"
context="{'create_bill':True}"
attrs="{'invisible': ['|', ('state', 'not in', ('purchase', 'done')), ('invoice_status', 'in', ('no', 'invoiced'))]}"
data-hotkey="w" groups="sf_base.group_purchase,sf_base.group_purchase_director"/>
</xpath>
<xpath expr="//form/header/button[@name='action_create_invoice'][2]" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<!-- <xpath expr="//form/header/button[@name='action_create_invoice[2]']" position="attributes">-->
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
<!-- </xpath>-->
<xpath expr="//form/header/button[@name='confirm_reminder_mail']" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<xpath expr="//form/header/button[@name='button_draft']" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<xpath expr="//form/header/button[@name='button_cancel']" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<xpath expr="//form/header/button[@name='button_unlock']" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<xpath expr="//form/header/button[@name='button_done']" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<xpath expr="//form/sheet/div[@name='button_box']/button[@name='action_view_mrp_productions']"
position="attributes">
<attribute name="groups">mrp.group_mrp_user,sf_base.group_purchase,sf_base.group_purchase_director
</attribute>
</xpath>
<xpath expr="//form/sheet/div[@name='button_box']/button[@name='action_view_picking']"
position="replace">
<button type="object"
name="action_view_picking"
class="oe_stat_button"
icon="fa-truck" attrs="{'invisible':[('incoming_picking_count','=', 0)]}"
groups="stock.group_stock_user,sf_base.group_purchase,sf_base.group_purchase_director">
<field name="incoming_picking_count" widget="statinfo" string="收货"
help="Incoming Shipments"/>
</button>
</xpath>
<xpath expr="//field[@name='order_line']" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="after">
<field name="part_name" optional="show"/>
<!-- <field name="part_number" optional="show"/>-->
</xpath>
<xpath expr="//field[@name='date_order']" position="attributes">
<attribute name="string">签约日期</attribute>
</xpath>
<field name="payment_term_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<xpath expr="//field[@name='date_order']" position="after">
<field name="payment_term_id" attrs="{'readonly': ['|', ('invoice_status','=', 'invoiced'), ('state', '=', 'done')]}" options="{'no_create': True}"/>
<!-- <field name="contract_summary"/>-->
</xpath>
<field name="partner_ref" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<field name="date_planned" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<field name="receipt_reminder_email" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<field name="user_id" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<field name="origin" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<field name="payment_term_id" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<field name="fiscal_position_id" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<!-- 添加采购类型字段 -->
<field name="partner_id" position="after">
<field name="purchase_type" string="采购类型" readonly="1"/>
<field name="picking_type_id" string="作业类型" domain="[('code','=','incoming'), '|', ('warehouse_id', '=', False), ('warehouse_id.company_id', '=', company_id)]" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
<field name="urgent_purchase"/>
<label for="date_planned" string="最近交货日期"/>
<div name="date_planned_div" class="o_row">
<field name="date_planned" attrs="{'readonly': [('state', 'not in', ('draft', 'sent', 'to approve', 'purchase'))]}"/>
<field name="mail_reminder_confirmed" invisible="1"/>
<span class="text-muted" attrs="{'invisible': [('mail_reminder_confirmed', '=', False)]}">(confirmed by vendor)</span>
</div>
<field name="effective_date" attrs="{'invisible': [('effective_date', '=', False)]}" string="到货时间"/>
</field>
<field name="partner_ref" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<xpath expr="//sheet/group/group[2]/field[1]" position="before">
<field name="partner_ref" string="合同名称"/>
<field name="contract_number"/>
</xpath>
<xpath expr="//sheet/group/group[2]/field[@name='effective_date']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<!-- 隐藏 label -->
<xpath expr="//label[@for='receipt_reminder_email']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<!-- 隐藏整个 reminder div -->
<xpath expr="//div[@name='reminder']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<!-- 使用更精确的路径定位原始元素 -->
<xpath expr="//sheet/group/group[2]/label[@for='date_planned']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//sheet/group/group[2]/div[@name='date_planned_div']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<record id="purchase_order_kpis_tree_inherit_sf" model="ir.ui.view">
<field name="name">purchase.stock.order.tree.inherit.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_kpis_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree//header//button[@name='action_create_invoice']" position="attributes">
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
</xpath>
<xpath expr="//field[@name='user_id']" position="attributes">
<attribute name="string">采购员</attribute>
</xpath>
<xpath expr="//field[@name='origin']" position="attributes">
<attribute name="string">源单据</attribute>
</xpath>
<xpath expr="//field[@name='activity_ids']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='date_order']" position="attributes">
<attribute name="string">签约日期</attribute>
<attribute name="widget">''</attribute>
</xpath>
<xpath expr="//field[@name='date_planned']" position="replace">
</xpath>
<xpath expr="//field[@name='date_order']" position="after">
<field name="date_planned" string="最近交货日期"/>
</xpath>
<xpath expr="//field[@name='name']" position="after">
<field name="purchase_type"/>
</xpath>
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="class">purchase_order_list_name</attribute>
</xpath>
</field>
</record>
<record id="purchase_stock_order_view_form_inherit_sf" model="ir.ui.view">
<field name="name">purchase.stock.order.form.inherit.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase_stock.purchase_order_view_form_inherit"/>
<field name="arch" type="xml">
<field name="incoterm_id" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}</attribute>
</field>
<field name="incoterm_location" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</field>
<xpath expr="//field[@name='picking_type_id'][1]" position="replace">
</xpath>
</field>
</record>
<record id="view_purchase_order_view_tree_inherit_sf" model="ir.ui.view">
<field name="name">purchase.order.tree.inherit.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_view_tree"/>
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="default_order">date_approve asc</attribute>
<attribute name="decoration-warning">delivery_warning == 'warning'</attribute>
<attribute name="decoration-danger">delivery_warning == 'overdue'</attribute>
</tree>
<xpath expr="//field[@name='activity_ids']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='date_planned']" position="replace">
</xpath>
<xpath expr="//field[@name='user_id']" position="attributes">
<attribute name="string">采购员</attribute>
</xpath>
<xpath expr="//field[@name='origin']" position="attributes">
<attribute name="string">源单据</attribute>
</xpath>
<xpath expr="//field[@name='user_id']" position="after">
<field name="delivery_warning" optional="show"/>
<field name="date_planned" string="最近交货日期" optional="show" widget="date"/>
</xpath>
<xpath expr="//field[@name='name']" position="after">
<field name="purchase_type"/>
<field name="delivery_warning" invisible="1"/>
</xpath>
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="class">purchase_order_list_name</attribute>
</xpath>
</field>
</record>
<record id="view_purchase_order_view_search_inherit_sf" model="ir.ui.view">
<field name="name">purchase.order.search.inherit.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_view_search"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='order_date']" position="after">
<separator/>
<filter string="正常" name="filter_order_normal"
domain="['|', ('delivery_warning', '=', 'normal'), ('delivery_warning', '=', False)]"/>
<filter string="预警" name="filter_order_warning" domain="[('delivery_warning', '=', 'warning')]"/>
<filter string="逾期" name="filter_order_overdue" domain="[('delivery_warning', '=', 'overdue')]"/>
</xpath>
</field>
</record>
<record id="purchase_order_search_inherit_sf" model="ir.ui.view">
<field name="name">purchase.order.list.select.inherit.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.view_purchase_order_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="replace">
<field name="name" string="单据编码" filter_domain="[('name', 'ilike', self)]"/>
</xpath>
<!-- <xpath expr="//search" position="inside">-->
<!-- <searchpanel>-->
<!-- <field name="purchase_type" icon="fa-filter"/>-->
<!-- <field name="state" icon="fa-filter"/>-->
<!-- </searchpanel>-->
<!-- </xpath>-->
</field>
</record>
<record id="purchase_order_view_search_sf" model="ir.ui.view">
<field name="name">purchase.order.list.select.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_view_search"/>
<field name="arch" type="xml">
<xpath expr="//search" position="inside">
<searchpanel>
<field name="purchase_type" icon="fa-filter" enable_counters="1"/>
<field name="delivery_warning" icon="fa-filter" enable_counters="1"/>
</searchpanel>
</xpath>
</field>
</record>
<record id="purchase.product_normal_action_puchased" model="ir.actions.act_window">
<field name="context">
{"search_default_categ_id":1,"search_default_filter_to_purchase":1, "purchase_product_template": 1}
</field>
<field name="view_mode">tree,kanban,form,activity</field>
</record>
</data>
</odoo>