[REM] stock: overprocessed quantity wizard.
As this wizard only shows the first product overprocessed and does nothing else, we remove it completely for cleaning purposes. task-1938108 closes odoo/odoo#39161 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
committed by
Simon Lejeune
parent
30b1af7937
commit
eddc695ac3
@@ -233,10 +233,7 @@ class TestStockValuation(TransactionCase):
|
||||
picking1 = po1.picking_ids[0]
|
||||
move1 = picking1.move_lines[0]
|
||||
move1.quantity_done = 15
|
||||
res_dict = picking1.button_validate()
|
||||
self.assertEqual(res_dict['res_model'], 'stock.overprocessed.transfer')
|
||||
wizard = self.env[(res_dict.get('res_model'))].browse(res_dict.get('res_id'))
|
||||
wizard.action_confirm()
|
||||
picking1.button_validate()
|
||||
|
||||
# there should be only one move
|
||||
self.assertEqual(len(picking1.move_lines), 1)
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
'wizard/stock_scheduler_compute_views.xml',
|
||||
'wizard/stock_immediate_transfer_views.xml',
|
||||
'wizard/stock_backorder_confirmation_views.xml',
|
||||
'wizard/stock_overprocessed_transfer_views.xml',
|
||||
'wizard/stock_quantity_history.xml',
|
||||
'wizard/stock_rules_report_views.xml',
|
||||
'wizard/stock_warn_insufficient_qty_views.xml',
|
||||
|
||||
@@ -851,20 +851,6 @@ class Picking(models.Model):
|
||||
'context': self.env.context,
|
||||
}
|
||||
|
||||
if self._get_overprocessed_stock_moves() and not self._context.get('skip_overprocessed_check'):
|
||||
view = self.env.ref('stock.view_overprocessed_transfer')
|
||||
wiz = self.env['stock.overprocessed.transfer'].create({'picking_id': self.id})
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'stock.overprocessed.transfer',
|
||||
'views': [(view.id, 'form')],
|
||||
'view_id': view.id,
|
||||
'target': 'new',
|
||||
'res_id': wiz.id,
|
||||
'context': self.env.context,
|
||||
}
|
||||
|
||||
# Check backorder should check for other barcodes
|
||||
if self._check_backorder():
|
||||
return self.action_generate_backorder_wizard()
|
||||
@@ -920,13 +906,6 @@ class Picking(models.Model):
|
||||
for picking in self.filtered(lambda picking: picking.immediate_transfer and picking.state not in ('done', 'cancel') and (picking.move_lines or picking.package_level_ids)):
|
||||
picking.action_confirm()
|
||||
|
||||
def _get_overprocessed_stock_moves(self):
|
||||
self.ensure_one()
|
||||
return self.move_lines.filtered(
|
||||
lambda move: move.product_uom_qty != 0 and float_compare(move.quantity_done, move.product_uom_qty,
|
||||
precision_rounding=move.product_uom.rounding) == 1
|
||||
)
|
||||
|
||||
def _create_backorder(self):
|
||||
|
||||
""" This method is called when the user chose to create a backorder. It will create a new
|
||||
|
||||
@@ -1970,9 +1970,7 @@ class StockMove(SavepointCase):
|
||||
'location_dest_id': backorder.location_dest_id.id,
|
||||
'picking_id': backorder.id,
|
||||
})]})
|
||||
overprocessed_wizard_dict = backorder.button_validate()
|
||||
overprocessed_wizard = self.env[overprocessed_wizard_dict['res_model']].browse(overprocessed_wizard_dict['res_id'])
|
||||
overprocessed_wizard.action_confirm()
|
||||
backorder.button_validate()
|
||||
backorder_move = backorder.move_lines
|
||||
self.assertEqual(backorder_move.state, 'done')
|
||||
self.assertEqual(backorder_move.quantity_done, 12.0)
|
||||
@@ -2136,9 +2134,7 @@ class StockMove(SavepointCase):
|
||||
'move_id': backordered_move.id,
|
||||
})]})
|
||||
|
||||
overprocessed_wizard = backorder.button_validate()
|
||||
overprocessed_wizard = self.env['stock.overprocessed.transfer'].browse(overprocessed_wizard['res_id'])
|
||||
overprocessed_wizard.action_confirm()
|
||||
backorder.button_validate()
|
||||
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product_serial, self.customer_location), 3)
|
||||
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product_serial, self.pack_location), 0)
|
||||
@@ -3554,11 +3550,6 @@ class StockMove(SavepointCase):
|
||||
self.assertTrue(isinstance(action, dict), 'Should open backorder wizard')
|
||||
self.assertEqual(action.get('res_model'), 'stock.backorder.confirmation')
|
||||
|
||||
product3_move.move_line_ids[0].qty_done = 2
|
||||
action = picking.button_validate() # should request confirmation
|
||||
self.assertTrue(isinstance(action, dict), 'Should open overprocessing wizard')
|
||||
self.assertEqual(action.get('res_model'), 'stock.overprocessed.transfer')
|
||||
|
||||
def test_immediate_validate_7(self):
|
||||
""" In a picking with a single unavailable move, clicking on validate without filling any
|
||||
quantities should display an UserError telling the user he cannot process a picking without
|
||||
|
||||
@@ -7,7 +7,6 @@ from . import stock_change_product_qty
|
||||
from . import stock_scheduler_compute
|
||||
from . import stock_immediate_transfer
|
||||
from . import stock_backorder_confirmation
|
||||
from . import stock_overprocessed_transfer
|
||||
from . import stock_quantity_history
|
||||
from . import stock_rules_report
|
||||
from . import stock_warn_insufficient_qty
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="view_overprocessed_transfer" model="ir.ui.view">
|
||||
<field name="name">stock.overprocessed.transfer.view.form</field>
|
||||
<field name="model">stock.overprocessed.transfer</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Processed more than initial demand">
|
||||
<p>
|
||||
You have processed more than what was initially
|
||||
planned for the product <field name="overprocessed_product_name" class="oe_inline"/>.
|
||||
</p>
|
||||
<p>
|
||||
Are you sure you want to validate this picking?
|
||||
</p>
|
||||
<footer>
|
||||
<button name="action_confirm" string="Confirm" type="object" class="btn-primary"/>
|
||||
<button string="Cancel" special="cancel" class="btn-secondary"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user