Files
odoo_source/addons/purchase/tests/common.py
T
amoyaux c914df5a36 [IMP] stock,mrp,purchase: split _run method and move it to rules
Previously mrp, stock and purchase used _run methon on procurement
group and start with a if checking for the action type. This commit
instead launch a specific method depending the rule's action's type

Also _run method and their submethod used in procurement group
was always called with a rule. Thus we choose to move this method
on the rule object himself.
2017-09-08 17:08:06 +02:00

37 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
from datetime import timedelta
from odoo import fields
from odoo.addons.stock.tests.common2 import TestStockCommon
class TestPurchase(TestStockCommon):
def _create_make_procurement(self, product, product_qty, date_planned=False):
ProcurementGroup = self.env['procurement.group']
order_values = {
'warehouse_id': self.warehouse_1,
'date_planned': date_planned or fields.Datetime.to_string(fields.datetime.now() + timedelta(days=10)), # 10 days added to current date of procurement to get future schedule date and order date of purchase order.
'group_id': self.env['procurement.group'],
}
return ProcurementGroup.run(product, product_qty, self.uom_unit, self.warehouse_1.lot_stock_id, product.name, '/', order_values)
@classmethod
def setUpClass(cls):
super(TestPurchase, cls).setUpClass()
cls.route_buy = cls.warehouse_1.buy_pull_id.route_id.id
cls.route_mto = cls.warehouse_1.mto_pull_id.route_id.id
# Update product_1 with type, route and Delivery Lead Time
cls.product_1.write({
'type': 'product',
'route_ids': [(6, 0, [cls.route_buy, cls.route_mto])],
'seller_ids': [(0, 0, {'name': cls.partner_1.id, 'delay': 5})]})
# Update product_2 with type, route and Delivery Lead Time
cls.product_2.write({
'type': 'product',
'route_ids': [(6, 0, [cls.route_buy, cls.route_mto])],
'seller_ids': [(0, 0, {'name': cls.partner_1.id, 'delay': 2})]})