-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.0][FIX] stock_orderpoint_purchase_link:
* update PO line passes orderpoints * add tests [UPD] Update stock_orderpoint_purchase_link.pot
- Loading branch information
1 parent
67a2461
commit f26ae89
Showing
5 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
stock_orderpoint_purchase_link/i18n/stock_orderpoint_purchase_link.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_orderpoint_purchase_link | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: stock_orderpoint_purchase_link | ||
#: model:ir.model,name:stock_orderpoint_purchase_link.model_stock_warehouse_orderpoint | ||
msgid "Minimum Inventory Rule" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_purchase_link | ||
#: model:ir.model.fields,field_description:stock_orderpoint_purchase_link.field_purchase_order_line_orderpoint_ids | ||
#: model:ir.ui.view,arch_db:stock_orderpoint_purchase_link.purchase_order_form | ||
#: model:ir.ui.view,arch_db:stock_orderpoint_purchase_link.purchase_order_line_form2 | ||
msgid "Orderpoints" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_purchase_link | ||
#: model:ir.model,name:stock_orderpoint_purchase_link.model_procurement_rule | ||
msgid "Procurement Rule" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_purchase_link | ||
#: model:ir.model,name:stock_orderpoint_purchase_link.model_purchase_order_line | ||
msgid "Purchase Order Line" | ||
msgstr "" | ||
|
||
#. module: stock_orderpoint_purchase_link | ||
#: model:ir.model.fields,field_description:stock_orderpoint_purchase_link.field_stock_warehouse_orderpoint_purchase_line_ids | ||
msgid "Purchase Order Lines" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_stock_orderpoint_purchase_link |
77 changes: 77 additions & 0 deletions
77
stock_orderpoint_purchase_link/tests/test_stock_orderpoint_purchase_link.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright 2018 Eficent Business and IT Consulting Services S.L. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0). | ||
|
||
from odoo.tests import common | ||
|
||
|
||
class TestOrderpointPurchaseLink(common.TransactionCase): | ||
def setUp(self): | ||
super(TestOrderpointPurchaseLink, self).setUp() | ||
|
||
self.product_obj = self.env['product.product'] | ||
self.partner_obj = self.env['res.partner'] | ||
self.pol_obj = self.env['purchase.order.line'] | ||
self.location_obj = self.env['stock.location'] | ||
self.orderpoint_obj = self.env['stock.warehouse.orderpoint'] | ||
self.route_obj = self.env['stock.location.route'] | ||
self.rule_obj = self.env['procurement.rule'] | ||
self.group_obj = self.env['procurement.group'] | ||
|
||
# WH and routes: | ||
self.warehouse = self.env.ref('stock.warehouse0') | ||
self.stock_location = self.warehouse.lot_stock_id | ||
self.test_location = self.location_obj.create({ | ||
'name': 'Test', | ||
'location_id': self.warehouse.view_location_id.id, | ||
}) | ||
route_buy = self.env.ref('purchase.route_warehouse0_buy').id | ||
route_test = self.route_obj.create({ | ||
'name': 'Stock to Test', | ||
}).id | ||
self.rule_obj.create({ | ||
'name': 'Stock to Test', | ||
'action': 'move', | ||
'procure_method': 'make_to_order', | ||
'location_id': self.test_location.id, | ||
'location_src_id': self.stock_location.id, | ||
'route_id': route_test, | ||
'picking_type_id': self.warehouse.int_type_id.id, | ||
'warehouse_id': self.warehouse.id, | ||
'group_propagation_option': 'none', | ||
}) | ||
# Partners: | ||
vendor1 = self.partner_obj.create({'name': 'Vendor 1'}) | ||
|
||
# Create products: | ||
self.tp1 = self.product_obj.create({ | ||
'name': 'Test Product 1', | ||
'type': 'product', | ||
'list_price': 150.0, | ||
'route_ids': [(6, 0, [route_buy, route_test])], | ||
'seller_ids': [(0, 0, {'name': vendor1.id, 'price': 20.0})], | ||
}) | ||
|
||
# Create Orderpoints: | ||
self.op1 = self.orderpoint_obj.create({ | ||
'product_id': self.tp1.id, | ||
'location_id': self.stock_location.id, | ||
'product_min_qty': 5.0, | ||
'product_max_qty': 20.0, | ||
}) | ||
self.op2 = self.orderpoint_obj.create({ | ||
'product_id': self.tp1.id, | ||
'location_id': self.test_location.id, | ||
'product_min_qty': 5.0, | ||
'product_max_qty': 20.0, | ||
}) | ||
|
||
def test_01_po_line_from_orderpoints(self): | ||
"""Test that a PO line created/updated by two orderpoints keeps | ||
the link with both of them.""" | ||
self.group_obj.run_scheduler() | ||
po_line = self.env['purchase.order.line'].search( | ||
[('product_id', '=', self.tp1.id)]) | ||
self.assertTrue(po_line) | ||
# Each orderpoint must have required 20.0 units: | ||
self.assertEqual(po_line.product_qty, 40.0) | ||
self.assertEqual(len(po_line.orderpoint_ids), 2) |