|  | <?xml version="1.0"?>
<openerp>
	<data>
		<!-- 采购订单视图 -->
		<record id="buy_order_list" model="ir.ui.view">
			<field name="name">buy.order.list</field>
			<field name="model">buy.order</field>
			<field name="arch" type="xml">
				<list string="采购订单" decoration-info='state == "draft"' decoration-muted='state == "cancel"' decoration-danger='paid_no_goods'>
					<field name="date" optional="show"/>
					<field name="name" optional="show"/>
					<field name="type" optional="hide"/>
					<field name="partner_id" optional="show"/>
					<field name="details" widget="html" optional="show"/>
					<field name="amount" sum="合计" optional="show"/>
					<field name='currency_id'
						 groups='base.group_multi_currency' optional="show"/>
					<field name="state" optional="show"/>
					<field name="goods_state" optional="show"/>
					<field name="paid_amount" optional="hide"/>
					<field name="ref" optional="show"/>
					<field name="paid_no_goods" invisible="1"/>
				</list>
			</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" invisible="state=='done'" string="确认" type="object" class="oe_highlight"/>
						<button name="buy_order_draft" invisible="state=='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" invisible="state=='draft' or 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" invisible="state=='draft'or 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" invisible="state=='draft' or invoice_count==0">
								<field name="invoice_count" widget="statinfo" string="结算单" help="Vendor Invoice"/>
								<field name="invoice_ids" invisible="1"/>
							</button>
						</div>
						<group colspan="2">
							<group>
								<field name="partner_id" required="1"
								domain="[('s_category_id', '!=', False)]"
						        options="{'no_open': True, 'no_create': True}"
								context="{'form_view_ref': 'core.supplier_address_form'}"
								readonly="state != 'draft'"/>
								<field name='contact' readonly="state != 'draft'"/>
								<field name='address_id' readonly="state != 'draft'"/>
								<field name='user_id'
                                       options="{'no_open': True, 'no_create': True}"
                                       readonly="state != 'draft'"/>
								<field name="date" required="1" readonly="state != 'draft'"/>
								<field name="warehouse_dest_id" readonly="state != 'draft'"/>
								<field name="invoice_by_receipt" readonly="state != 'draft'"/>
							</group>
							<group>
							    <field name="ref" readonly="state != 'draft'"/>
								<field name="planned_date" required="1" readonly="state != 'draft'"/>
								<field name="type" widget="radio" readonly="state != 'draft'"/>
								<field name="goods_state" readonly="1"/>
								<field name='currency_id'
									   groups='base.group_multi_currency'
									   readonly="state != 'draft'"/>
								<field name="pay_method" readonly="state != 'draft'"/>
								<field name="express_type" readonly="state != 'draft'"/>
								<field name="term_id" readonly="state != 'draft'"/>
								<field name="project_id" readonly="state!='draft'"/>
							</group>
						</group>
						<notebook>
							<page name="line_ids" string="采购订单行">
								<field name="line_ids" readonly="state != 'draft'">
									<list string="采购订单行" editable="bottom">
										<field name="goods_id" required='1' domain="[('not_buyable','=',False)]" optional="show"/>
										<field name="attribute_id"
										groups='goods.multi_attrs_groups'
										required="using_attribute" readonly="not using_attribute" optional="show"/>
										<field name="goods_uos_qty" sum="合计辅助数量"
											groups="goods.auxiliary_unit_groups" optional="show"/>
										<field name='uos_id' groups='goods.auxiliary_unit_groups'  force_save="1"  optional="show"/>
										<field name="quantity" sum="合计数量" optional="show"/>
										<field name="quantity_in" readonly="1" sum="合计已入库数量" optional="show"/>
										<field name="uom_id" readonly='1' force_save="1" optional="show"/>
										<field name="price" optional="show"/>
										<field name="price_taxed" groups='buy.in_tax_groups' optional="show"/>
										<field name="discount_rate" groups='buy.buy_line_discount_groups' optional="show"/>
										<field name="discount_amount" sum="合计折扣额" groups='buy.buy_line_discount_groups' optional="show"/>
										<field name="amount" sum="合计金额" optional="show"/>
										<field name="tax_rate" groups='buy.in_tax_groups' optional="show"/>
										<field name="tax_amount" sum="合计税额" groups='buy.in_tax_groups' optional="show"/>
										<field name="subtotal" sum="价税合计的合计" groups='buy.in_tax_groups' optional="show"/>
										<field name="procure_date" optional="show"/>
										<field name="note" optional="show"/>
										<field name='using_attribute' column_invisible='1'/>
									</list>
								</field>
								<field name="pay_ids" invisible="invoice_by_receipt">
									<list string="Payment Form" editable="bottom" >
										<field name="name"
										readonly="date_application"
										/>
										<field name="amount_money" sum="合计"
										readonly="date_application"
										/>
										<field name="date_application"></field>
										<button name="request_payment" type="object"
										string="申请付款" invisible="date_application"></button>
									</list>
								</field>
								<field name="note" placeholder="暂无备注信息"/>
								<group>
									<group>
										<field name="discount_amount" groups='buy.buy_discount_groups' readonly="state != 'draft'"/>
										<field name="amount"/>
										<field name="paid_amount"/>
									</group>
									<group>
										<field name="prepayment" invisible="not invoice_by_receipt" readonly="state != 'draft'"/>
										<field name="bank_account_id" invisible="not invoice_by_receipt" readonly="state != 'draft'"/>
										<field name="money_order_id" invisible="not invoice_by_receipt"/>
									</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>
							</page>
						</notebook>
					</sheet>
					<chatter/>
				</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 name="by_partner" string="供应商" domain="[]" context="{'group_by':'partner_id'}"/>
						<filter name="by_date" string="单据日期" domain="[]" context="{'group_by':'date:day'}"/>
						<filter name="by_plan_date" string="要求交货日期" domain="[]" context="{'group_by':'planned_date:day'}"/>
						<filter name="by_state" string="确认状态" domain="[]" context="{'group_by':'state:day'}"/>
						<filter name="by_goods_state" string="收货状态" domain="[]" context="{'group_by':'state'}"/>
					</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')]"
								readonly="state=='draft'"/>
                </field>
            </field>
        </record>
	</data>
</openerp>
 |