stock_view.xml 7.86 KB
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <!-- In the form view of Incoming/Outgoing products, make the tree view of move lines editable and set the parameters that are only present in the form view to the fields of the tree view-->

<record id="view_stock_move_tree_editable"  model="ir.ui.view">
    <field name="name">view_stock_move_tree_editable</field>
    <field name="model">stock.move</field>
    <field name="inherit_id" ref="stock.view_move_picking_tree" />
    <field name="arch" type="xml">
        <xpath expr="/tree[@string='Stock Moves']" position="attributes">
            <attribute name="editable">bottom</attribute>
        </xpath>
        <xpath expr="//field[@name='product_id']" position="attributes">
            <attribute name="on_change">onchange_product_id(product_id,location_id,location_dest_id, False)</attribute>
        </xpath>
        <!-- we need to have the "name" field in the tree view, because it is a required field that is set by the on_change on product_id... otherwise we get an error message when adding a new move line via the editable tree view -->
        <xpath expr="//field[@name='product_id']" position="after">
            <field name="name" invisible="1"/>
        </xpath>
        <!-- For the field product_qty, the on_change is already in the original tree view -->
        <xpath expr="//field[@name='prodlot_id']" position="attributes">
            <attribute name="context">{'location_id':location_id, 'product_id':product_id}</attribute>
            <attribute name="domain">[('product_id','=?',product_id)]</attribute>
            <attribute name="on_change">onchange_lot_id(prodlot_id, product_qty, location_id, product_id, product_uom)</attribute>
        </xpath>
        <!-- I want to have the field location_id visible and placed before dest_location_id -->
        <xpath expr="//field[@name='location_id']" position="replace">
        </xpath>
        <xpath expr="//field[@name='location_dest_id']" position="before">
            <field name="product_packaging" groups="product.group_stock_packaging" domain="[('product_id','=',product_id)]" invisible="context.get('picking_type') != 'out' or False"/>
            <field name="location_id" groups="stock.group_locations"/>
        </xpath>
        <xpath expr="//button[@name='%(stock.track_line)d']" position="replace">
            <button name="split_move" string="Manual Split"
                    groups="stock.group_production_lot"
                    states="draft,waiting,confirmed,assigned"
                    type="object" icon="gtk-justify-fill" />
        </xpath>
        <!-- In the form view of Incoming shipments, add the "new_prodlot_code" field -->
        <xpath expr="//field[@name='prodlot_id']" position="before">
            <field name="new_prodlot_code" groups="stock.group_production_lot" invisible="context.get('picking_type') != 'in' or False" />
        </xpath>
        <!-- In the form view of Incoming shipments, add the "new_tracking_code" field -->
        <xpath expr="//field[@name='tracking_id']" position="before">
            <field name="new_tracking_code" groups="stock.group_tracking_lot" invisible="context.get('picking_type') != 'in' or False" />
        </xpath>
    </field>
</record>

<record id="view_move_form_manual_split" model="ir.ui.view">
    <field name="name">view.stock.move.form.manual_split</field>
    <field name="model">stock.move</field>
    <field name="inherit_id" ref="stock.view_move_form" />
    <field name="priority">24</field> <!-- inherit after product_hardware_revision -->
    <field name="arch" type="xml">
        <xpath expr="//button[@string='Split']" position="after">
            <button name="split_move" string="Manual split"
                states="draft,waiting,confirmed,assigned"
                type="object" icon="gtk-justify-fill" />
        </xpath>
    </field>
</record>

<!-- Add "last_location_id" on prod lot view -->
<record id="view_production_lot_form_unique_production_number" model="ir.ui.view">
    <field name="name">view_production_lot_form_unique_production_number</field>
    <field name="model">stock.production.lot</field>
    <field name="inherit_id" ref="stock.view_production_lot_form"/>
    <field name="arch" type="xml">
        <field name="stock_available" position="after">
            <field name="last_location_id"/>
        </field>
    </field>
</record>

<act_window
    domain="[('last_location_id', '=', active_id)]"
    id="act_prodlot_location_open"
    name="Prodlots"
    res_model="stock.production.lot"
    src_model="stock.location"/>

<record id="ir_act_prodlot_location_open" model="ir.values">
    <field name="key2">tree_but_open</field>
    <field name="model">stock.location</field>
    <field name="name">Prodlots</field>
    <field eval="'ir.actions.act_window,%d'%act_prodlot_location_open" name="value"/>
</record>

	<!-- Wizard to help users input production lots in batch -->
<!-- TODO Nan-TIc : port to v6
	<record id="view_stock_picking_prodlot_selection" model="ir.ui.view">
		<field name="name">stock.picking.prodlot.selection</field>
		<field name="model">stock.picking.prodlot.selection</field>
		<field name="arch" type="xml">
			<form string="Select Production Lots">
				<field name="product_id" colspan="4"/>
				<field name="first_lot"/>
				<field name="last_lot"/>
				<button type="object" name="action_cancel" string="Cancel" icon="gtk-cancel" special="cancel" colspan="2"/>
				<button type="object" name="action_accept" string="Accept" icon="gtk-ok" colspan="2"/>
			</form>
		</field>
	</record>

	<record model="ir.actions.act_window" id="action_prodlot_selection">
		<field name="name">Select Production Lots</field>
		<field name="res_model">stock.picking.prodlot.selection</field>
		<field name="view_type">form</field>
		<field name="view_mode">form</field>
		<field name="target">new</field>
	</record>

	<record id="view_picking_form" model="ir.ui.view">
		<field name="name">stock.picking.form.prodlot.selection</field>
		<field name="model">stock.picking</field>
		<field name="inherit_id" ref="stock.view_picking_form"/>
		<field name="arch" type="xml">
			<xpath expr="/form/notebook/page/group/label[@colspan='6']" position="replace">
				<label colspan="5"/>
				<button type="action" name="%(action_prodlot_selection)d" string="Spread Production Lots" states="draft,confirmed,assigned"/>
			</xpath>
		</field>
	</record>

	<record id="view_picking_in_form" model="ir.ui.view">
		<field name="name">stock.picking.in.form.prodlot.selection</field>
		<field name="model">stock.picking</field>
		<field name="inherit_id" ref="stock.view_picking_in_form"/>
		<field name="arch" type="xml">
			<xpath expr="/form/notebook/page/group/label[@colspan='5']" position="replace">
				<label colspan="4"/>
				<button type="action" name="%(action_prodlot_selection)d" string="Spread Production Lots" states="draft,confirmed,assigned"/>
			</xpath>
		</field>
	</record>

	<record id="view_picking_out_form" model="ir.ui.view">
		<field name="name">stock.picking.out.form</field>
		<field name="model">stock.picking</field>
		<field name="inherit_id" ref="stock.view_picking_out_form"/>
		<field name="arch" type="xml">
			<xpath expr="/form/notebook/page/group/label[@colspan='6']" position="replace">
				<label colspan="5"/>
				<button type="action" name="%(action_prodlot_selection)d" string="Spread Production Lots" states="draft,confirmed,assigned"/>
			</xpath>
		</field>
	</record>

	<record id="view_picking_delivery_form" model="ir.ui.view">
		<field name="name">stock.picking.delivery.form</field>
		<field name="model">stock.picking</field>
		<field name="inherit_id" ref="stock.view_picking_delivery_form"/>
		<field name="arch" type="xml">
			<xpath expr="/form/notebook/page/group/label[@colspan='6']" position="replace">
				<label colspan="5"/>
				<button type="action" name="%(action_prodlot_selection)d" string="Spread Production Lots" states="draft,confirmed,assigned"/>
			</xpath>
		</field>
	</record>
-->

</data>
</openerp>