mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_orderpoint_manual_procurement_uom: Migration to 11.0
This commit is contained in:
committed by
Miquel Raïch
parent
8bce7462cc
commit
f8d9d34d82
@@ -17,7 +17,7 @@ measure indicated in the reordering rule.
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/153/10.0
|
||||
:target: https://runbot.odoo-community.org/runbot/153/11.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
@@ -39,6 +39,7 @@ Contributors
|
||||
------------
|
||||
|
||||
* Lois Rilo Antelo <lois.rilo@eficent.com>
|
||||
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
@@ -6,7 +5,7 @@
|
||||
"name": "Stock Orderpoint Manual Procurement UoM",
|
||||
"summary": "Glue module for stock_orderpoint_uom and "
|
||||
"stock_orderpoint_manual_procurement",
|
||||
"version": "10.0.1.0.0",
|
||||
"version": "11.0.1.0.0",
|
||||
"author": "Eficent, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
@@ -19,5 +18,4 @@
|
||||
"license": "AGPL-3",
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto-install': True,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import stock_warehouse_orderpoint
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
@@ -11,12 +10,10 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
|
||||
@api.multi
|
||||
def _get_procure_recommended_qty(self, virtual_qty, op_qtys):
|
||||
procure_recommended_qty = \
|
||||
product_qty = \
|
||||
super(StockWarehouseOrderpoint, self)._get_procure_recommended_qty(
|
||||
virtual_qty, op_qtys)
|
||||
if self.procure_uom_id:
|
||||
product_qty = self.product_id.uom_id._compute_quantity(
|
||||
procure_recommended_qty, self.procure_uom_id)
|
||||
else:
|
||||
product_qty = procure_recommended_qty
|
||||
product_qty, self.procure_uom_id)
|
||||
return product_qty
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import test_stock_orderpoint_manual_procurement
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
@@ -13,6 +12,10 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
|
||||
# Refs
|
||||
self.group_stock_manager = self.env.ref('stock.group_stock_manager')
|
||||
self.group_purchase_manager = self.env.ref(
|
||||
'purchase.group_purchase_manager')
|
||||
self.vendor = self.env.ref(
|
||||
'stock_orderpoint_manual_procurement.product_supplierinfo_product_7') # noqa
|
||||
self.group_change_procure_qty = self.env.ref(
|
||||
'stock_orderpoint_manual_procurement.'
|
||||
'group_change_orderpoint_procure_qty')
|
||||
@@ -21,6 +24,8 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
# Get required Model
|
||||
self.reordering_rule_model = self.env['stock.warehouse.orderpoint']
|
||||
self.product_model = self.env['product.product']
|
||||
self.purchase_model = self.env['purchase.order']
|
||||
self.purchase_line_model = self.env['purchase.order.line']
|
||||
self.user_model = self.env['res.users']
|
||||
self.product_ctg_model = self.env['product.category']
|
||||
self.stock_change_model = self.env['stock.change.product.qty']
|
||||
@@ -30,7 +35,8 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
# Create users
|
||||
self.user = self._create_user('user_1',
|
||||
[self.group_stock_manager,
|
||||
self.group_change_procure_qty],
|
||||
self.group_change_procure_qty,
|
||||
self.group_purchase_manager],
|
||||
self.company1)
|
||||
# Get required Model data
|
||||
self.product_uom = self.env.ref('product.product_uom_unit')
|
||||
@@ -68,7 +74,6 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
"""Create a Product Category."""
|
||||
product_ctg = self.product_ctg_model.create({
|
||||
'name': 'test_product_ctg',
|
||||
'type': 'normal',
|
||||
})
|
||||
return product_ctg
|
||||
|
||||
@@ -79,6 +84,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
'categ_id': self.product_ctg.id,
|
||||
'type': 'product',
|
||||
'uom_id': self.product_uom.id,
|
||||
'variant_seller_ids': [(6, 0, [self.vendor.id])],
|
||||
})
|
||||
return product
|
||||
|
||||
@@ -122,12 +128,18 @@ class TestStockWarehouseOrderpoint(common.TransactionCase):
|
||||
# Create Manual Procurement from order-point procured quantity
|
||||
self.create_orderpoint_procurement()
|
||||
|
||||
# As per route configuration, it will create Purchase order
|
||||
# Assert that Procurement is created with the desired quantity
|
||||
self.assertTrue(self.reorder.procurement_ids)
|
||||
purchase = self.purchase_model.search(
|
||||
[('origin', 'ilike', self.reorder.name)])
|
||||
self.assertEquals(len(purchase), 1)
|
||||
purchase_line = self.purchase_line_model.search(
|
||||
[('orderpoint_id', '=', self.reorder.id),
|
||||
('order_id', '=', purchase.id)])
|
||||
self.assertEquals(len(purchase_line), 1)
|
||||
self.assertEqual(self.reorder.product_id.id,
|
||||
self.reorder.procurement_ids.product_id.id)
|
||||
self.assertEqual(self.reorder.name,
|
||||
self.reorder.procurement_ids.origin)
|
||||
purchase_line.product_id.id)
|
||||
self.assertEqual(self.reorder.name, purchase.origin)
|
||||
self.assertNotEqual(self.reorder.procure_recommended_qty,
|
||||
self.reorder.procurement_ids.product_qty)
|
||||
self.assertEqual(self.reorder.procurement_ids.product_qty, 40)
|
||||
purchase_line.product_qty)
|
||||
self.assertEqual(purchase_line.product_qty, 40)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import make_procurement_orderpoint
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
Reference in New Issue
Block a user