stock_usability: clean-up zero-qty quants when opening quants from stock.location
When accessing stock.move.line from the show reservation on quants, in the form view of stock.move.line, have a link to the picking
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from . import stock_move
|
from . import stock_move
|
||||||
from . import stock_picking
|
from . import stock_picking
|
||||||
from . import stock_picking_type
|
from . import stock_picking_type
|
||||||
|
from . import stock_location
|
||||||
from . import stock_location_route
|
from . import stock_location_route
|
||||||
from . import stock_warehouse_orderpoint
|
from . import stock_warehouse_orderpoint
|
||||||
from . import stock_quant
|
from . import stock_quant
|
||||||
|
|||||||
14
stock_usability/models/stock_location.py
Normal file
14
stock_usability/models/stock_location.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Copyright 2023 Akretion France (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class StockLocation(models.Model):
|
||||||
|
_inherit = 'stock.location'
|
||||||
|
|
||||||
|
def action_show_quants(self):
|
||||||
|
self.ensure_one()
|
||||||
|
action = self.env['stock.quant']._get_quants_action(domain=[('location_id', 'child_of', self.id)])
|
||||||
|
return action
|
||||||
@@ -24,5 +24,5 @@ class StockQuant(models.Model):
|
|||||||
('package_id', '=', self.package_id.id or False),
|
('package_id', '=', self.package_id.id or False),
|
||||||
('result_package_id', '=', self.package_id.id or False),
|
('result_package_id', '=', self.package_id.id or False),
|
||||||
]
|
]
|
||||||
action['context'] = {'create': 0}
|
action['context'] = {'create': 0, 'stock_move_line_main_view': True}
|
||||||
return action
|
return action
|
||||||
|
|||||||
@@ -40,6 +40,10 @@
|
|||||||
string="Reordering Rules"
|
string="Reordering Rules"
|
||||||
class="oe_stat_button" icon="fa-refresh"/>
|
class="oe_stat_button" icon="fa-refresh"/>
|
||||||
</div>
|
</div>
|
||||||
|
<button name="%(stock.location_open_quants)d" position="attributes">
|
||||||
|
<attribute name="type">object</attribute>
|
||||||
|
<attribute name="name">action_show_quants</attribute>
|
||||||
|
</button>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,17 @@
|
|||||||
<field name="context">{'search_default_done': 1}</field>
|
<field name="context">{'search_default_done': 1}</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="view_move_line_form" model="ir.ui.view">
|
||||||
|
<field name="name">stock_usability.stock.move.line.form</field>
|
||||||
|
<field name="model">stock.move.line</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_move_line_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="reference" position="before">
|
||||||
|
<field name="picking_id" invisible="not context.get('stock_move_line_main_view')"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="view_move_line_tree" model="ir.ui.view">
|
<record id="view_move_line_tree" model="ir.ui.view">
|
||||||
<field name="name">stock_usability.stock.move.line.tree</field>
|
<field name="name">stock_usability.stock.move.line.tree</field>
|
||||||
<field name="model">stock.move.line</field>
|
<field name="model">stock.move.line</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user