stock_usability: backport improvements from v14 (show reservations on quants tree view)
Also add button to access stock.move.line from lots
This commit is contained in:
@@ -147,6 +147,21 @@ class StockQuant(models.Model):
|
|||||||
action['context'] = {'search_default_todo': True}
|
action['context'] = {'search_default_todo': True}
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
def action_stock_move_lines_reserved(self):
|
||||||
|
self.ensure_one()
|
||||||
|
action = self.env['ir.actions.act_window'].for_xml_id('stock', 'stock_move_line_action')
|
||||||
|
action['domain'] = [
|
||||||
|
('state', 'not in', ('draft', 'done')),
|
||||||
|
('product_id', '=', self.product_id.id),
|
||||||
|
('location_id', '=', self.location_id.id),
|
||||||
|
('lot_id', '=', self.lot_id.id or False),
|
||||||
|
'|',
|
||||||
|
('package_id', '=', self.package_id.id or False),
|
||||||
|
('result_package_id', '=', self.package_id.id or False),
|
||||||
|
]
|
||||||
|
action['context'] = {'create': 0}
|
||||||
|
return action
|
||||||
|
|
||||||
|
|
||||||
class StockInventoryLine(models.Model):
|
class StockInventoryLine(models.Model):
|
||||||
_inherit = 'stock.inventory.line'
|
_inherit = 'stock.inventory.line'
|
||||||
|
|||||||
@@ -398,6 +398,11 @@ should be able to access it. So I add a menu entry under Inventory Control. -->
|
|||||||
<field name="reserved_quantity" position="attributes">
|
<field name="reserved_quantity" position="attributes">
|
||||||
<attribute name="sum">1</attribute>
|
<attribute name="sum">1</attribute>
|
||||||
</field>
|
</field>
|
||||||
|
<!-- Move available_quantity AFTER quantity -->
|
||||||
|
<field name="quantity" position="after">
|
||||||
|
<field name="reserved_quantity" position="move"/>
|
||||||
|
<button type="object" name="action_stock_move_lines_reserved" string="Reservations" attrs="{'invisible': [('reserved_quantity', '=', 0)]}"/>
|
||||||
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -432,6 +437,24 @@ So I create another "regular" Quants" menu entry -->
|
|||||||
parent="stock.menu_stock_inventory_control"
|
parent="stock.menu_stock_inventory_control"
|
||||||
sequence="135"/>
|
sequence="135"/>
|
||||||
|
|
||||||
|
<record id="stock_move_line_from_lot_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Product Moves</field>
|
||||||
|
<field name="res_model">stock.move.line</field>
|
||||||
|
<field name="view_mode">tree,kanban,pivot,form</field>
|
||||||
|
<field name="domain">[('lot_id', '=', active_id)]</field>
|
||||||
|
<field name="context">{'search_default_done': 1, 'create': 0}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_production_lot_form" model="ir.ui.view">
|
||||||
|
<field name="model">stock.production.lot</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_production_lot_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<div name="button_box" position="inside">
|
||||||
|
<button name="%(stock_move_line_from_lot_action)d" string="Product Moves" type="action" icon="fa-exchange"/>
|
||||||
|
</div>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="stock.action_production_lot_form" model="ir.actions.act_window">
|
<record id="stock.action_production_lot_form" model="ir.actions.act_window">
|
||||||
<field name="context">{}</field> <!-- remove group by product -->
|
<field name="context">{}</field> <!-- remove group by product -->
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user