osbzr/gooderp_addons

View on GitHub
warehouse/view/inventory_view.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id='wh_inventory_tree' model='ir.ui.view'>
            <field name='name'>wh.inventory.tree</field>
            <field name='model'>wh.inventory</field>
            <field name='arch' type='xml'>
                <tree string='盘点单' colors='blue:state in ("draft", "query");red:state == "confirmed"'>
                    <field name='name' />
                    <field name='date' />
                    <field name='warehouse_id' groups='warehouse.multi_warehouse_groups' />
                    <field name='state' />
                </tree>
            </field>
        </record>

        <record id='wh_inventory_form' model='ir.ui.view'>
            <field name='name'>wh.inventory.form</field>
            <field name='model'>wh.inventory</field>
            <field name='arch' type='xml'>
                <form string='盘点单'>
                    <header>
                        <button name='query_inventory' string='查询' type='object' class='oe_highlight' states='draft' />
                        <button name='query_inventory' string='查询' type='object' states='query' />
                        <button name='generate_inventory' string='生成盘点数据' type='object' class='oe_highlight' states='query' />

                        <button name='open_out' string='查看盘亏单据' type='object' class='oe_highlight' attrs="{'invisible': ['|', ('state', 'in', ('draft', 'query')), ('out_id', '=', False)]}" />
                        <button name='open_in' string='查看盘盈单据' type='object' class='oe_highlight' attrs="{'invisible': ['|', ('state', 'in', ('draft', 'query')), ('in_id', '=', False)]}" />

                        <button name='requery_inventory' string='重新盘点' type='object' states='confirmed' />

                        <field name='state' widget='statusbar' readonly='1' />
                    </header>
                    <sheet>
                        <div>
                            <p>在盘点完成前,请不要做出入库单据,盘点库存与查询时的系统库存比较计算盈亏,如果库存在查询后又发生了变化,需要重新查询一次获取最新的库存信息</p>
                            <label string="扫描条码"/>
                            <input type='text' class="ge_scan_barcode" autofocus="true"/>
                        </div>

                        <group >
                            <group>
                                <field name='warehouse_id' attrs="{'readonly': [('state', '!=', 'draft')]}"/>
                                <field name='goods' widget="many2many_tags" attrs="{'readonly': [('state', '!=', 'draft')]}" />
                                <field name='out_id' invisible='1' />
                                <field name='in_id' invisible='1' />
                            </group>
                            <group>
                                <field name='date' required='1' attrs="{'readonly': [('state', '!=', 'draft')]}" />
                            </group>
                        </group>

                        <group string='盘点明细'>
                            <field name='line_ids' nolabel='1' context="{'lot': True}" attrs="{'readonly': [('state', 'not in', ('draft', 'query'))]}" >
                                <tree string='盘点明细' create='0' delete='0' editable='bottom'>
                                    <field name='goods_id' readonly='1 '/>
                                    <field name='attribute_id' readonly='1' groups='goods.multi_attrs_groups' />
                                    <field name='lot' readonly='1' groups='goods.batch_groups' />
                                    <field name='real_uos_qty' readonly='1' sum='1' groups='goods.auxiliary_unit_groups' />
                                    <field name='real_qty' readonly='1' sum='1' />
                                    <field name='inventory_uos_qty' sum='1' groups='goods.auxiliary_unit_groups' />
                                    <field name='uos_id' readonly='1' groups='goods.auxiliary_unit_groups' />
                                    <field name='inventory_qty' sum='1' />
                                    <field name='uom_id' readonly='1' />
                                    <!--readonly 应该为invisible ?-->
                                    <field name='new_lot'
                                        attrs="{'readonly': [('lot_type', '!=', 'in')], 'required': [('lot_type', '=', 'in')]}"
                                        groups='goods.batch_groups' />

                                    <!--批号已有,所以不需要盘亏批号,去掉盘亏批号-->
                                    <!-- <field name='new_lot_id'
                                        attrs="{'readonly': [('lot_type', '!=', 'out')], 'required': [('lot_type', '=', 'out')]}"
                                        domain="[('goods_id', '=', goods_id), ('state', '=', 'done'), ('lot', '!=', False), ('qty_remaining', '>', 0), ('lot', '=', lot)]"
                                        context="{'lot': True}"
                                        options="{'no_open': True, 'no_create': True}"
                                        groups='goods.batch_groups'
                                        invisible='1' /> -->
                                    <field name='difference_uos_qty' readonly='1' sum='1' groups='goods.auxiliary_unit_groups' />
                                    <field name='difference_qty' readonly='1' sum='1' />
                                    <field name='lot_type' invisible='1' />
                                </tree>
                            </field>
                        </group>

                        <group>
                            <field name='note' nolabel='1' placeholder='备注...' />
                        </group>

                        <group >
                            <group >
                                <field name='create_uid' string='制单人' readonly='1' />
                                <field name='create_date' string='录单时间' readonly='1' />
                            </group>
                            <group >
                                <field name='write_uid' string='最后修改人' readonly='1' />
                                <field name='write_date' string='最后修改时间' readonly='1' />
                            </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='wh_inventory_search' model='ir.ui.view'>
            <field name='name'>wh.inventory.search</field>
            <field name='model'>wh.inventory</field>
            <field name='arch' type='xml'>
                <search string='盘点表' >
                    <field name='name'/>
                    <field name='warehouse_id'/>
                    <field name='goods'/>
                    <filter string="未完成" domain="[('state','!=','done')]" name="not_done_inventory_filter"/>
                    <group expand="0" string="分组">
                        <filter string="仓库" domain="[]" context="{'group_by':'warehouse_id'}"/>
                        <filter string="商品" domain="[]" context="{'group_by':'goods'}"/>
                        <filter string="单据日期" domain="[]" context="{'group_by':'date:day'}"/>
                    </group>
                </search>
            </field>
        </record>

    </data>
</openerp>