summaryrefslogtreecommitdiff
path: root/addons/sale_stock/tests
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2019-03-18 15:27:18 +0000
committerArnold Moyaux <arm@odoo.com>2019-03-20 14:22:09 +0000
commit277e32d2dcf03a764f0ea49817564fb92a20b2d5 (patch)
tree2b62388e65cdfc1df652f9105d8d2d6efd2af67d /addons/sale_stock/tests
parent8a7b6a4f9c2ab2e8d208e735f86b0c9477a2ca64 (diff)
[IMP] stock: allow to change picking on returns
The code that generate the return lines is moved inside an onchange. The purpose is to allow an inherit that will modify the picking_id of the wizard. It should trigger the new return lines without a call to default_get. task_id 1909413
Diffstat (limited to 'addons/sale_stock/tests')
-rw-r--r--addons/sale_stock/tests/test_anglo_saxon_valuation_reconciliation.py8
-rw-r--r--addons/sale_stock/tests/test_sale_stock.py9
2 files changed, 10 insertions, 7 deletions
diff --git a/addons/sale_stock/tests/test_anglo_saxon_valuation_reconciliation.py b/addons/sale_stock/tests/test_anglo_saxon_valuation_reconciliation.py
index f80c4bf758c..cf444c56bb3 100644
--- a/addons/sale_stock/tests/test_anglo_saxon_valuation_reconciliation.py
+++ b/addons/sale_stock/tests/test_anglo_saxon_valuation_reconciliation.py
@@ -4,7 +4,7 @@
import time
from odoo.addons.stock_account.tests.test_anglo_saxon_valuation_reconciliation_common import ValuationReconciliationTestCase
-from odoo.tests import tagged
+from odoo.tests import Form, tagged
@tagged('post_install', '-at_install')
@@ -139,8 +139,10 @@ class TestValuationReconciliation(ValuationReconciliationTestCase):
'rate': 10.54739702,
'name': '2018-03-01',
})
- stock_return_picking = self.env['stock.return.picking']\
- .with_context(active_ids=[picking.id], active_id=picking.id).create({})
+ stock_return_picking_form = Form(self.env['stock.return.picking']
+ .with_context(active_ids=picking.ids, active_id=picking.ids[0],
+ active_model='stock.picking'))
+ stock_return_picking = stock_return_picking_form.save()
stock_return_picking.product_return_moves.quantity = 1.0
stock_return_picking_action = stock_return_picking.create_returns()
return_pick = self.env['stock.picking'].browse(stock_return_picking_action['res_id'])
diff --git a/addons/sale_stock/tests/test_sale_stock.py b/addons/sale_stock/tests/test_sale_stock.py
index 7782ecdc7f1..9bea6fa8847 100644
--- a/addons/sale_stock/tests/test_sale_stock.py
+++ b/addons/sale_stock/tests/test_sale_stock.py
@@ -3,7 +3,7 @@
from odoo.addons.sale.tests.test_sale_common import TestSale
from odoo.exceptions import UserError
-from odoo.tests import tagged
+from odoo.tests import Form, tagged
@tagged('post_install', '-at_install')
@@ -159,9 +159,10 @@ class TestSaleStock(TestSale):
self.inv_1.action_invoice_open()
# Create return picking
- StockReturnPicking = self.env['stock.return.picking']
- default_data = StockReturnPicking.with_context(active_ids=pick.ids, active_id=pick.ids[0]).default_get(['move_dest_exists', 'original_location_id', 'product_return_moves', 'parent_location_id', 'location_id'])
- return_wiz = StockReturnPicking.with_context(active_ids=pick.ids, active_id=pick.ids[0]).create(default_data)
+ stock_return_picking_form = Form(self.env['stock.return.picking']
+ .with_context(active_ids=pick.ids, active_id=pick.ids[0],
+ active_model='stock.picking'))
+ return_wiz = stock_return_picking_form.save()
return_wiz.product_return_moves.quantity = 2.0 # Return only 2
return_wiz.product_return_moves.to_refund = True # Refund these 2
res = return_wiz.create_returns()