stock_restrict_source_location/views/stock_move_line_views.xml

91 lines
6.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_stock_move_operations_restrict" model="ir.ui.view">
<field name="name">stock.move.operations.form.restrict</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_stock_move_operations"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_line_ids']" position="before">
<field name="allowed_source_location_ids" invisible="1"/>
</xpath>
</field>
</record>
<record id="view_mrp_stock_move_operations_restrict" model="ir.ui.view">
<field name="name">stock.move.mrp.operations.form.restrict</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="mrp.view_mrp_stock_move_operations"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='allowed_source_location_ids']" position="replace"/>
<xpath expr="//field[@name='move_line_ids']" position="before">
<field name="allowed_source_location_ids" invisible="1"/>
</xpath>
<xpath expr="//field[@name='move_line_ids']" position="attributes">
<attribute name="context">{'list_view_ref': 'stock.view_stock_move_line_operation_tree', 'form_view_ref': 'stock.view_move_line_mobile_form', 'default_picking_id': picking_id, 'default_move_id': id, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_company_id': company_id, 'active_picking_id': picking_id, 'active_mo_id': context.get('active_mo_id'), 'default_picking_type_id': picking_type_id, 'default_allowed_source_location_ids': allowed_source_location_ids}</attribute>
</xpath>
</field>
</record>
<record id="view_stock_move_line_detailed_operation_tree_restrict" model="ir.ui.view">
<field name="name">stock.move.line.detailed.operation.tree.restrict</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='picking_id']" position="after">
<field name="allowed_source_location_ids" invisible="1"/>
</xpath>
<xpath expr="//field[@name='quant_id']" position="attributes">
<!-- Rely on backend StockQuant._search override for location filtering -->
<attribute name="context">{'default_location_id': location_id, 'default_product_id': product_id, 'search_view_ref': 'stock.quant_search_view', 'list_view_ref': 'stock.view_stock_quant_tree', 'form_view_ref': 'stock.view_stock_quant_form', 'readonly_form': True, 'show_src_package': 1, 'active_mo_id': context.get('active_mo_id'), 'default_picking_type_id': context.get('default_picking_type_id'), 'default_allowed_source_location_ids': allowed_source_location_ids}</attribute>
</xpath>
<xpath expr="//field[@name='lot_id']" position="attributes">
<!-- Add default_location_id to context so python override can filter lots for transit receipts -->
<attribute name="context">{'default_product_id': product_id, 'active_picking_id': picking_id, 'default_location_id': location_id}</attribute>
</xpath>
<xpath expr="//field[@name='location_id']" position="attributes">
<!-- Rely on backend StockLocation._name_search override -->
<attribute name="options">{'no_create': True}</attribute>
</xpath>
</field>
</record>
<record id="view_stock_move_line_operation_tree_restrict" model="ir.ui.view">
<field name="name">stock.move.line.operation.tree.restrict</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_id']" position="after">
<field name="allowed_source_location_ids" invisible="1"/>
</xpath>
<xpath expr="//field[@name='quant_id']" position="attributes">
<!-- Rely on backend StockQuant._search override for location filtering -->
<attribute name="context">{'default_location_id': location_id, 'default_product_id': product_id, 'search_view_ref': 'stock.quant_search_view', 'list_view_ref': 'stock.view_stock_quant_tree', 'form_view_ref': 'stock.view_stock_quant_form', 'readonly_form': True, 'show_src_package': 1, 'active_mo_id': context.get('active_mo_id'), 'default_picking_type_id': context.get('default_picking_type_id'), 'default_allowed_source_location_ids': allowed_source_location_ids}</attribute>
</xpath>
<xpath expr="//field[@name='lot_id']" position="attributes">
<attribute name="context">{'default_product_id': parent.product_id, 'active_picking_id': picking_id, 'default_location_id': location_id}</attribute>
</xpath>
<xpath expr="//field[@name='location_id']" position="attributes">
<!-- Rely on backend StockLocation._name_search override -->
<attribute name="options">{'no_create': True}</attribute>
</xpath>
</field>
</record>
<record id="view_move_line_form_restrict" model="ir.ui.view">
<field name="name">stock.move.line.form.restrict</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='location_id']" position="before">
<field name="picking_type_id" invisible="1"/>
<field name="move_id" invisible="1"/>
<field name="allowed_source_location_ids" invisible="1"/>
</xpath>
<xpath expr="//field[@name='location_id']" position="attributes">
<!-- Rely on backend StockLocation._name_search override -->
<attribute name="options">{'no_create': True}</attribute>
</xpath>
</field>
</record>
</odoo>