Files
odoo-usability/mrp_usability_akretion/views/mrp_production.xml
2024-12-31 11:28:06 +01:00

42 lines
2.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016-2024 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="mrp_production_form_view" model="ir.ui.view">
<field name="name">usability.mrp.production.form</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<field name="user_id" position="before">
<!-- I can't use position="move" because it would match another field in an embedded tree view -->
<field name="location_src_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" readonly="state != 'draft'"/>
<field name="location_dest_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" readonly="state in ('done', 'cancel')"/>
</field>
<!-- It is important to remove the original field location_dest_id
and not just set it as invisible because it cancels the changes -->
<xpath expr="//page[@name='miscellaneous']/group/group/field[@name='location_dest_id']" position="replace"/>
<xpath expr="//page[@name='miscellaneous']/group/group/field[@name='location_src_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<record id="mrp_production_tree_view" model="ir.ui.view">
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_tree_view"/>
<field name="arch" type="xml">
<field name="reservation_state" position="after">
<field name="location_src_id" optional="hide" groups="stock.group_stock_multi_locations"/>
<field name="location_dest_id" optional="hide" groups="stock.group_stock_multi_locations"/>
</field>
</field>
</record>
</odoo>