buy/views/buy_order_view.xml
<?xml version="1.0"?>
<openerp>
<data>
<!-- 购货订单视图 -->
<record id="buy_order_tree" model="ir.ui.view">
<field name="name">buy.order.tree</field>
<field name="model">buy.order</field>
<field name="arch" type="xml">
<tree string="购货订单" colors='blue:state == "draft";lightgray:state == "cancel"'>
<field name="date"/>
<field name="name"/>
<field name="type"/>
<field name="partner_id"/>
<field name="amount" sum="合计"/>
<field name='currency_id'
groups='finance.group_multi_currency'/>
<field name="state"/>
<field name="_approve_state"/>
<field name="goods_state"/>
<field name="paid_amount"/>
<field name="ref"/>
</tree>
</field>
</record>
<record id="buy_order_form" model="ir.ui.view">
<field name="name">buy.order.form</field>
<field name="model">buy.order</field>
<field name="arch" type="xml">
<form string="购货订单">
<header>
<button name="buy_order_done" states="draft" string="确认" type="object" class="oe_highlight"/>
<button name="buy_order_draft" states="done" string="撤销" type="object"/>
<button name="action_cancel" states="draft" string="作废" type="object"/>
<field name="state" widget="statusbar" statusbar_visible="draft,done" statusbar_colors='{"done":"blue"}' readonly="1"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button type="object"
name="action_view_receipt"
class="oe_stat_button"
icon="fa-truck" attrs="{'invisible':['|', ('state', 'in', ('draft')),('receipt_count','=',0)]}">
<field name="receipt_count" widget="statinfo" string="入库单" help="Incoming Shipments"/>
<field name="receipt_ids" invisible="1"/>
</button>
<button type="object"
name="action_view_return"
class="oe_stat_button"
icon="fa-truck" attrs="{'invisible':['|', ('state', 'in', ('draft')),('return_count','=',0)]}">
<field name="return_count" widget="statinfo" string="退货单" help="Incoming Shipments"/>
<field name="receipt_ids" invisible="1"/>
</button>
<button type="object"
name="action_view_invoice"
class="oe_stat_button"
icon="fa-pencil-square-o" attrs="{'invisible':['|', ('state', 'in', ('draft')),('invoice_count','=',0)]}">
<field name="invoice_count" widget="statinfo" string="结算单" help="Vendor Invoice"/>
<field name="invoice_ids" invisible="1"/>
</button>
</div>
<group>
<group>
<field name="partner_id" required="1"
domain="[('s_category_id', '!=', False)]"
context="{'form_view_ref': 'core.supplier_address_form'}"/>
<field name='user_id'
options="{'no_open': True, 'no_create': True}"/>
<field name="date" required="1"/>
<field name="warehouse_dest_id"/>
<field name="invoice_by_receipt"></field>
</group>
<group>
<field name="ref"/>
<field name="planned_date" required="1"/>
<field name="type" widget="radio"/>
<field name="goods_state" readonly="1"/>
<field name='currency_id' readonly='1'
groups='finance.group_multi_currency'/>
</group>
</group>
<field name="line_ids">
<tree string="购货订单行" editable="bottom">
<field name="goods_id" required='1' domain="[('not_buyable','=',False)]"/>
<field name="attribute_id"
groups='goods.multi_attrs_groups'
attrs="{'required': [('using_attribute','=', True)], 'readonly': [('using_attribute','!=', True)]}"/>
<field name="quantity" sum="合计数量"/>
<field name="quantity_in" readonly="1" sum="合计已入库数量"/>
<field name="uom_id"/>
<field name="price"/>
<field name="price_taxed" groups='buy.in_tax_groups'/>
<field name="discount_rate" groups='buy.buy_line_discount_groups'/>
<field name="discount_amount" sum="合计折扣额" groups='buy.buy_line_discount_groups'/>
<field name='currency_amount' sum='外币合计'
groups='finance.group_multi_currency'/>
<field name="amount" sum="合计金额"/>
<field name="tax_rate" groups='buy.in_tax_groups'/>
<field name="tax_amount" sum="合计税额" groups='buy.in_tax_groups'/>
<field name="subtotal" sum="价税合计的合计" groups='buy.in_tax_groups'/>
<field name="note"/>
<field name="origin" invisible="1"/>
<field name='using_attribute' invisible='1'/>
</tree>
</field>
<field name="pay_ids" attrs="{'invisible': [('invoice_by_receipt','=',True)]}">
<tree string="Payment Form" editable="bottom" >
<field name="name"></field>
<field name="amount_money" sum="合计"></field>
<field name="date_application"></field>
<button name="request_payment" type="object"
string="确认" attrs="{'invisible': [('date_application','!=',False)]}"></button>
</tree>
</field>
<field name="note" placeholder="暂无备注信息"/>
<group>
<group>
<field name="discount_amount" groups='buy.buy_discount_groups'/>
<field name="amount"/>
<field name="paid_amount"/>
</group>
<group>
<field name="prepayment" attrs="{'invisible': [('invoice_by_receipt','=',False)]}"/>
<field name="bank_account_id" attrs="{'invisible': [('invoice_by_receipt','=',False)]}"/>
<field name="money_order_id" attrs="{'invisible': [('invoice_by_receipt','=',False)]}"/>
</group>
</group>
<group>
<group>
<field name="create_uid" readonly="1" string="制单人"/>
<field name="approve_uid" readonly="1"/>
</group>
<group>
<field name="create_date" readonly="1" string="录单时间"/>
<field name="write_date" readonly="1" string="最后修改时间"/>
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="_to_approver_ids" widget="goodprocess" readonly="1"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="buy_order_search" model="ir.ui.view">
<field name="name">buy.order.search</field>
<field name="model">buy.order</field>
<field name="arch" type="xml">
<search string="购货订单">
<field name="name"/>
<field name="type"/>
<field name="partner_id"/>
<field name="goods_id"/>
<field name="state"/>
<field name="goods_state"/>
<field name="create_uid" string="制单人"/>
<field name="approve_uid"/>
<filter name="draft" string="草稿" domain="[('state','=','draft')]"/>
<filter name="done" string="已确认" domain="[('state','=','done')]"/>
<separator/>
<filter name="not in" string="未入库" domain="[('goods_state','=',u'未入库')]"/>
<filter name="part in" string="部分入库" domain="[('goods_state','=',u'部分入库')]"/>
<filter name="all in" string="全部入库" domain="[('goods_state','=',u'全部入库')]"/>
<separator/>
<filter name="buy" string="购货" domain="[('type','=','buy')]"/>
<filter name="return" string="退货" domain="[('type','=','return')]"/>
<separator/>
<filter name="createby" string="我创建的" domain="[('create_uid', '=' ,uid)]"/>
<group expand="0" string="分组">
<filter string="供应商" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="单据日期" domain="[]" context="{'group_by':'date:day'}"/>
<filter string="要求交货日期" domain="[]" context="{'group_by':'planned_date:day'}"/>
</group>
</search>
</field>
</record>
<record id="money_order_form_add_buy_order" model="ir.ui.view">
<field name="name">money.order.form</field>
<field name="model">money.order</field>
<field name='inherit_id' ref='money.money_order_form'/>
<field name="arch" type="xml">
<field name="voucher_id" position="after">
<field name="buy_id"
invisible="context.get('default_get', 0)"
domain="[('state','=','done')]"
groups="buy.buy_groups"
attrs="{'readonly':[('state', '!=', 'draft')]}"/>
</field>
</field>
</record>
</data>
</openerp>