stock_usability: usability improvements on inventory and picking form view

This commit is contained in:
Alexis de Lattre
2022-01-21 11:24:59 +01:00
parent b72d8c44d4
commit af806f7bcc
2 changed files with 31 additions and 1 deletions

View File

@@ -146,3 +146,16 @@ class StockQuant(models.Model):
action = self.action_view_stock_moves()
action['context'] = {'search_default_todo': True}
return action
class StockInventoryLine(models.Model):
_inherit = 'stock.inventory.line'
state = fields.Selection(store=True)
partner_id = fields.Many2one(states={'done': [('readonly', True)]})
product_id = fields.Many2one(states={'done': [('readonly', True)]})
product_uom_id = fields.Many2one(states={'done': [('readonly', True)]})
product_qty = fields.Float(states={'done': [('readonly', True)]})
location_id = fields.Many2one(states={'done': [('readonly', True)]})
package_id = fields.Many2one(states={'done': [('readonly', True)]})
prod_lot_id = fields.Many2one(states={'done': [('readonly', True)]})

View File

@@ -23,6 +23,11 @@
<button name="action_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this picking?</attribute>
</button>
<!-- picking_type_id updates location_id and location_dest_id, we it's
better to put it BEFORE in the view, not AFTER ! -->
<field name="location_id" position="before">
<field name="picking_type_id" position="move"/>
</field>
<!-- STOCK MOVE -->
<!-- This sum is useful to check the 'number of items' to transfer... -->
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_uom_qty']" position="attributes">
@@ -350,7 +355,9 @@ should be able to access it. So I add a menu entry under Inventory Control. -->
<button name="action_reset_product_qty" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to reset all quantities to 0 ?</attribute>
</button>
<button name="action_inventory_line_tree" position="attributes">
<attribute name="states">confirm,done</attribute>
</button>
</field>
</record>
@@ -370,6 +377,16 @@ should be able to access it. So I add a menu entry under Inventory Control. -->
</field>
</record>
<record id="stock_inventory_line_tree2" model="ir.ui.view">
<field name="model">stock.inventory.line</field>
<field name="inherit_id" ref="stock.stock_inventory_line_tree2"/>
<field name="arch" type="xml">
<field name="prod_lot_id" position="attributes">
<attribute name="attrs">{'readonly': ['|', ('product_tracking', '=', 'none'), ('state', '=', 'done')]}</attribute>
</field>
</field>
</record>
<record id="view_stock_quant_tree" model="ir.ui.view">
<field name="name">stock.usability.quant.tree</field>
<field name="model">stock.quant</field>