Skip to content
Snippets Groups Projects
Commit 53ebf749 authored by Rémy Voet (ryv)'s avatar Rémy Voet (ryv)
Browse files

[REM] stock: remove dead-code

Remove dead code of the main stock module:
 - Unused actions
 - Unused private methods
 - Unused helper methods test
parent 238e7436
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,3 @@ class StockScrap(models.Model):
else:
vals.update({'raw_material_production_id': self.production_id.id})
return vals
def _get_origin_moves(self):
return super(StockScrap, self)._get_origin_moves() or self.production_id and self.production_id.move_raw_ids.filtered(lambda x: x.product_id == self.product_id)
......@@ -527,9 +527,6 @@ class InventoryLine(models.Model):
vals_list.append(vals)
return self.env['stock.move'].create(vals_list)
def _refresh_inventory(self):
return self[0].inventory_id.action_open_inventory_lines()
def action_refresh_quantity(self):
filtered_lines = self.filtered(lambda l: l.state != 'done')
for line in filtered_lines:
......
......@@ -212,21 +212,3 @@ class Route(models.Model):
for route in self:
route.with_context(active_test=False).rule_ids.filtered(lambda ru: ru.active == route.active).toggle_active()
super(Route, self).toggle_active()
def view_product_ids(self):
return {
'name': _('Products'),
'view_mode': 'tree,form',
'res_model': 'product.template',
'type': 'ir.actions.act_window',
'domain': [('route_ids', 'in', self.ids)],
}
def view_categ_ids(self):
return {
'name': _('Product Categories'),
'view_mode': 'tree,form',
'res_model': 'product.category',
'type': 'ir.actions.act_window',
'domain': [('route_ids', 'in', self.ids)],
}
......@@ -257,10 +257,6 @@ class StockQuant(models.Model):
if quant.location_id.usage == 'view':
raise ValidationError(_('You cannot take products from or deliver products to a location of type "view".'))
def _compute_name(self):
for quant in self:
quant.name = '%s: %s%s' % (quant.lot_id.name or quant.product_id.code or '', quant.quantity, quant.product_id.uom_id.name)
@api.model
def _get_removal_strategy(self, product_id, location_id):
if product_id.categ_id.removal_strategy_id:
......@@ -741,21 +737,5 @@ class QuantPackage(models.Model):
action['domain'] = [('id', 'in', pickings.ids)]
return action
def view_content_package(self):
action = self.env['ir.actions.act_window'].for_xml_id('stock', 'quantsact')
action['domain'] = [('id', 'in', self._get_contained_quants().ids)]
return action
def _get_contained_quants(self):
return self.env['stock.quant'].search([('package_id', 'in', self.ids)])
def _get_all_products_quantities(self):
'''This function computes the different product quantities for the given package
'''
# TDE CLEANME: probably to move somewhere else, like in pack op
res = {}
for quant in self._get_contained_quants():
if quant.product_id not in res:
res[quant.product_id] = 0
res[quant.product_id] += quant.quantity
return res
......@@ -97,9 +97,6 @@ class StockScrap(models.Model):
raise UserError(_('You cannot delete a scrap which is done.'))
return super(StockScrap, self).unlink()
def _get_origin_moves(self):
return self.picking_id and self.picking_id.move_lines.filtered(lambda x: x.product_id == self.product_id)
def _prepare_move_values(self):
self.ensure_one()
location_id = self.location_id.id
......
......@@ -796,16 +796,6 @@ class Warehouse(models.Model):
self.mapped('wh_pack_stock_loc_id').write({'active': new_delivery_step == 'pick_pack_ship'})
self.mapped('wh_output_stock_loc_id').write({'active': new_delivery_step != 'ship_only'})
def _location_used(self, location):
rules = self.env['stock.rule'].search_count([
'&',
('route_id', 'not in', [x.id for x in self.route_ids]),
'|', ('location_src_id', '=', location.id),
('location_id', '=', location.id)])
if rules:
return True
return False
# Misc
# ------------------------------------------------------------
......@@ -939,7 +929,6 @@ class Warehouse(models.Model):
routes = self.mapped('route_ids') | self.mapped('mto_pull_id').mapped('route_id')
routes |= self.env["stock.location.route"].search([('supplied_wh_id', 'in', self.ids)])
return routes
get_all_routes_for_wh = _get_all_routes
def action_view_all_routes(self):
routes = self._get_all_routes()
......
......@@ -34,7 +34,7 @@
</t>
<t t-if="l.reference == c">
<span t-if="c" t-att-class="spanclass">
<a t-att-data-active-id="l.res_id" t-att-data-res-model="l.res_model" class="o_stock_reports_web_action" href="#"><t t-raw="c" /></a>
<a t-att-data-active-id="l.res_id" t-att-data-res-model="l.res_model" class="o_stock_reports_web_action" href="#"><t t-raw="c"/></a>
</span>
</t>
<t t-elif="l.lot_name == c and l.lot_name != false">
......
......@@ -5,27 +5,6 @@ from odoo.addons.product.tests import common
class TestStockCommon(common.TestProductCommon):
def _create_pack_operation(self, product, product_qty, picking_id, **values):
PackOperation = self.env['stock.move.line'].with_user(self.user_stock_manager)
vals = {
'picking_id': picking_id.id,
'product_id': product.id,
'product_qty': product_qty,
'qty_done': product_qty}
vals.update(**values)
pack_operation = PackOperation.new(vals)
pack_operation.onchange_product_id()
return PackOperation.create(pack_operation._convert_to_write(pack_operation._cache))
def _create_picking_in(self, warehouse):
Picking = self.env['stock.picking']
picking_values = {
'picking_type_id': warehouse.in_type_id.id,
'location_id': self.env.ref('stock.stock_location_suppliers').id,
'location_dest_id': warehouse.lot_stock_id.id,
}
return Picking.create(picking_values)
def _create_move(self, product, src_location, dst_location, **values):
# TDE FIXME: user as parameter
Move = self.env['stock.move'].with_user(self.user_stock_manager)
......@@ -36,14 +15,6 @@ class TestStockCommon(common.TestProductCommon):
move_values.update(**values)
return Move.create(move_values)
def _create_move_in(self, product, warehouse, picking=None, create_picking=False, **values):
if not picking and create_picking:
picking = self._create_picking_in(warehouse)
if picking:
values['picking_id'] = picking.id
# TDE FIXME: shouldn't location come from picking ??
return self._create_move(product, self.env.ref('stock.stock_location_suppliers'), warehouse.lot_stock_id, **values)
@classmethod
def setUpClass(cls):
super(TestStockCommon, cls).setUpClass()
......
......@@ -38,7 +38,7 @@
</span>
</t>
<t t-else="">
<t t-raw="c"/>
<t t-raw="c"/>
</t>
</td>
</t>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment