stock_usability: Improve visibility on reservations

This commit is contained in:
Alexis de Lattre
2019-07-24 10:08:55 +02:00
parent 7d7a42ba8e
commit 7e0c438ae8
3 changed files with 52 additions and 3 deletions

View File

@@ -51,8 +51,9 @@ class ProcurementGroup(models.Model):
# If I don't do an explicit cr.commit(), it doesn't create
# the procurement.scheduler.log... I don't know why
self._cr.commit()
except:
logger.warning('Could not create procurement.scheduler.log')
except Exception as e:
logger.warning(
'Could not create procurement.scheduler.log (error: %s)', e)
return res

View File

@@ -78,7 +78,8 @@ class StockMove(models.Model):
in it'''
res = []
for line in self:
name = '%s > %s' % (line.location_id.name, line.location_dest_id.name)
name = '%s > %s' % (
line.location_id.name, line.location_dest_id.name)
if line.product_id.code:
name = '%s: %s' % (line.product_id.code, name)
if line.picking_id.origin:
@@ -112,3 +113,13 @@ class ProcurementGroup(models.Model):
picking_ids = fields.One2many(
'stock.picking', 'group_id', string='Pickings', readonly=True)
class StockQuant(models.Model):
_inherit = 'stock.quant'
def action_stock_move_lines_reserved(self):
self.ensure_one()
action = self.action_view_stock_moves()
action['context'] = {'search_default_todo': True}
return action

View File

@@ -235,6 +235,24 @@
</field>
</record>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">stock_usability.stock.move.line.tree</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_tree" />
<field name="arch" type="xml">
<field name="qty_done" position="before">
<field name="product_qty" sum="1" string="Reserved Qty"/>
</field>
<field name="qty_done" position="attributes">
<attribute name="sum">1</attribute>
</field>
</field>
</record>
<record id="stock.stock_move_line_action" model="ir.actions.act_window">
<field name="context">{'search_default_done': 1}</field>
</record>
<record id="view_warehouse" model="ir.ui.view">
<field name="name">stock.usability.warehouse.form</field>
<field name="model">stock.warehouse</field>
@@ -266,6 +284,10 @@
<group string="Group By" name="groupby">
<filter name="usage_groupby" string="Location Type"
context="{'group_by': 'usage'}"/>
<filter name="removal_strategy_groupby" string="Removal Strategy"
context="{'group_by': 'removal_strategy_id'}"/>
<filter name="putaway_strategy_groupby" string="Put Away Strategy"
context="{'group_by': 'putaway_strategy_id'}"/>
</group>
</filter>
</field>
@@ -333,6 +355,16 @@ should be able to access it. So I add a menu entry under Inventory Control. -->
</field>
</record>
<record id="view_stock_quant_form" model="ir.ui.view">
<field name="name">stock.usability.quant.form</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_form"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" icon="fa-arrows-v" type="object" name="action_stock_move_lines_reserved" string="Reservations"/>
</div>
</field>
</record>
<!-- more detailed stock.move tree view when using the button from product form -->
<!-- TODO TEST
<record id="stock.act_product_stock_move_open" model="ir.actions.act_window">
@@ -353,4 +385,9 @@ So I create another "regular" Quants" menu entry -->
parent="stock.menu_stock_inventory_control"
sequence="135"/>
<record id="stock.action_production_lot_form" model="ir.actions.act_window">
<field name="context">{}</field> <!-- remove group by product -->
</record>
</odoo>