[FIX] stock: update stock.move form view
The `stock.move` form view used for the detailed operation is also used when using Odoo on a mobile device and is not usable in such case (for example, the `product_id` is readonly.) To fix this issue, the view is modified this way: - The `product_id` is readonly only if the move has a id or already a move line (that way, the field is editable when creating a new move but is still readonly otherwise); - The `move_line_ids` is readonly until the move's product is set; - The demand qty. and the UoM are editable if the move is draft. Also, some similar mofifications are done to the `stock.move.line` form view too. OPW-3577844 Part-of: odoo/odoo#144282
This commit is contained in:
@@ -73,12 +73,13 @@
|
||||
<field name="location_dest_id" invisible="1"/>
|
||||
<field name="package_id" invisible="1"/>
|
||||
<field name="product_uom_category_id" invisible="1"/>
|
||||
<field name="tracking" invisible="1"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="date"/>
|
||||
<field name="reference" string="Reference"/>
|
||||
<field name="origin"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_id" readonly="context.get('default_product_id')"/>
|
||||
<field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_dest_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
|
||||
</group>
|
||||
@@ -88,8 +89,10 @@
|
||||
<field name="quantity"/>
|
||||
<field name="product_uom_id" options="{'no_create': True}" string="Unit of Measure" groups="uom.group_uom"/>
|
||||
</div>
|
||||
<field name="lot_id" groups="stock.group_production_lot" context="{'default_product_id': product_id, 'active_picking_id': picking_id, 'default_company_id': company_id}" invisible="not lot_id and lot_name"/>
|
||||
<field name="lot_name" groups="stock.group_production_lot" invisible="lot_id or not lot_name"/>
|
||||
<field name="lot_id" groups="stock.group_production_lot" context="{'default_product_id': product_id, 'active_picking_id': picking_id, 'default_company_id': company_id}"
|
||||
invisible="tracking == 'none' or not lot_id and lot_name"/>
|
||||
<field name="lot_name" groups="stock.group_production_lot"
|
||||
invisible="tracking == 'none' or lot_id or not lot_name"/>
|
||||
<field name="package_id" string="Source Package" groups="stock.group_tracking_lot"/>
|
||||
<field name="result_package_id" string="Destination Package" groups="stock.group_tracking_lot"/>
|
||||
<field name="owner_id" string="Owner" groups="stock.group_tracking_owner"/>
|
||||
|
||||
@@ -160,11 +160,11 @@
|
||||
<field name="show_lots_m2o" invisible="1"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_id" readonly="id or move_line_ids"/>
|
||||
<label for="product_uom_qty"/>
|
||||
<div class="o_row">
|
||||
<span><field name="product_uom_qty" readonly="1" nolabel="1"/></span>
|
||||
<span><field name="product_uom" groups="uom.group_uom" readonly="1" nolabel="1" options="{'no_open': True}"/></span>
|
||||
<span><field name="product_uom_qty" readonly="state != 'draft'" nolabel="1"/></span>
|
||||
<span><field name="product_uom" groups="uom.group_uom" readonly="state != 'draft'" nolabel="1" options="{'no_open': True}"/></span>
|
||||
</div>
|
||||
</group>
|
||||
<group/>
|
||||
@@ -174,7 +174,7 @@
|
||||
<widget class="btn btn-link btn-group" name="import_lots" invisible="not display_import_lot"/>
|
||||
</div>
|
||||
<field name="move_line_ids"
|
||||
readonly="state == 'cancel' or (state == 'done' and is_locked)"
|
||||
readonly="state == 'cancel' or (state == 'done' and is_locked) or not product_id"
|
||||
context="{'tree_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}"
|
||||
widget="sml_x2_many"/>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user