As the title describes, I would like to filter out or delete inventory adjustments for archived products. It seems like Odoo should have a better method of showing you which products are no longer in use. Are there any workarounds for this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
2032
Views
You can hide archived products from inventory adjustment by adding ('product_id.active','=',True) to the domain of server action which retrieve the inventory adjustment as below:
from odoo import _, api, fields, models
class StockQuant(models.Model):
_inherit = 'stock.quant'
@api.model
def action_view_inventory(self):
""" Similar to _get_quants_action except specific for inventory adjustments (i.e. inventory counts). """
self = self._set_view_context()
self._quant_tasks()
ctx = dict(self.env.context or {})
ctx['no_at_date'] = True
if self.user_has_groups('stock.group_stock_user') and not self.user_has_groups('stock.group_stock_manager'):
ctx['search_default_my_count'] = True
action = {
'name': _('Inventory Adjustments'),
'view_mode': 'list',
'view_id': self.env.ref('stock.view_stock_quant_tree_inventory_editable').id,
'res_model': 'stock.quant',
'type': 'ir.actions.act_window',
'context': ctx,
'domain': [('location_id.usage', 'in', ['internal', 'transit']), ('product_id.active', '=', True)],
'help': """
<p class="o_view_nocontent_smiling_face">
{}
</p><p>
{} <span class="fa fa-long-arrow-right"/> {}</p>
""".format(_('Your stock is currently empty'),
_('Press the CREATE button to define quantity for each product in your stock or import them from a spreadsheet throughout Favorites'),
_('Import')),
}
return action
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
3
Aug 24
|
291 | ||
|
0
Aug 21
|
1205 | ||
|
2
Mar 15
|
6820 | ||
|
1
Dec 24
|
102 | ||
|
2
Apr 24
|
718 |