[REV] purchase_stock: don't hide replenishment origin
This reverts commit 170729ee58b199041d7545e7789ac9474e86f998, per discussion with @thomasdeleval on linked ticket. opw-2422438 closes odoo/odoo#68293 X-original-commit: 5c2db20a14701f165adfecb391073c3d957081e9 Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com> Signed-off-by: Nicolas Galler <ngaller@users.noreply.github.com>
This commit is contained in:
@@ -44,11 +44,6 @@ class StockRule(models.Model):
|
||||
def _run_buy(self, procurements):
|
||||
procurements_by_po_domain = defaultdict(list)
|
||||
errors = []
|
||||
# Origins we don't want to appear in the PO source field.
|
||||
origins_to_hide = [
|
||||
_('Manual Replenishment'),
|
||||
_('Replenishment Report'),
|
||||
]
|
||||
for procurement, rule in procurements:
|
||||
|
||||
# Get the schedule date in order to find a valid seller
|
||||
@@ -93,7 +88,7 @@ class StockRule(models.Model):
|
||||
procurements, rules = zip(*procurements_rules)
|
||||
|
||||
# Get the set of procurement origin for the current domain.
|
||||
origins = set([p.origin for p in procurements if p.origin not in origins_to_hide])
|
||||
origins = set([p.origin for p in procurements])
|
||||
# Check if a PO exists for the current domain.
|
||||
po = self.env['purchase.order'].sudo().search([dom for dom in domain], limit=1)
|
||||
company_id = procurements[0].company_id
|
||||
|
||||
@@ -44,8 +44,9 @@ class TestReplenishWizard(TestStockCommon):
|
||||
})
|
||||
replenish_wizard.launch_replenishment()
|
||||
last_po_id = self.env['purchase.order'].search([
|
||||
('origin', 'ilike', '%Manual Replenishment%'),
|
||||
('partner_id', '=', self.vendor.id)
|
||||
], order="id desc", limit=1)
|
||||
])[-1]
|
||||
self.assertTrue(last_po_id, 'Purchase Order not found')
|
||||
order_line = last_po_id.order_line.search([('product_id', '=', self.product1.id)])
|
||||
self.assertTrue(order_line, 'The product is not in the Purchase Order')
|
||||
@@ -92,7 +93,9 @@ class TestReplenishWizard(TestStockCommon):
|
||||
'warehouse_id': self.wh.id,
|
||||
})
|
||||
replenish_wizard.launch_replenishment()
|
||||
last_po_id = self.env['purchase.order'].search([], order="id desc", limit=1)
|
||||
last_po_id = self.env['purchase.order'].search([
|
||||
('origin', 'ilike', '%Manual Replenishment%'),
|
||||
])[-1]
|
||||
self.assertEqual(last_po_id.partner_id, vendor1)
|
||||
self.assertEqual(last_po_id.order_line.price_unit, 100)
|
||||
|
||||
@@ -145,7 +148,9 @@ class TestReplenishWizard(TestStockCommon):
|
||||
'warehouse_id': self.wh.id,
|
||||
})
|
||||
replenish_wizard.launch_replenishment()
|
||||
last_po_id = self.env['purchase.order'].search([], order="id desc", limit=1)
|
||||
last_po_id = self.env['purchase.order'].search([
|
||||
('origin', 'ilike', '%Manual Replenishment%'),
|
||||
])[-1]
|
||||
self.assertEqual(last_po_id.partner_id, vendor1)
|
||||
self.assertEqual(last_po_id.order_line.price_unit, 100)
|
||||
|
||||
@@ -188,7 +193,9 @@ class TestReplenishWizard(TestStockCommon):
|
||||
'warehouse_id': self.wh.id,
|
||||
})
|
||||
replenish_wizard.launch_replenishment()
|
||||
last_po_id = self.env['purchase.order'].search([], order="id desc", limit=1)
|
||||
last_po_id = self.env['purchase.order'].search([
|
||||
('origin', 'ilike', '%Manual Replenishment%'),
|
||||
])[-1]
|
||||
self.assertEqual(last_po_id.partner_id, vendor2)
|
||||
|
||||
def test_chose_supplier_4(self):
|
||||
@@ -234,7 +241,9 @@ class TestReplenishWizard(TestStockCommon):
|
||||
'warehouse_id': self.wh.id,
|
||||
})
|
||||
replenish_wizard.launch_replenishment()
|
||||
last_po_id = self.env['purchase.order'].search([], order="id desc", limit=1)
|
||||
last_po_id = self.env['purchase.order'].search([
|
||||
('origin', 'ilike', '%Manual Replenishment%'),
|
||||
])[-1]
|
||||
|
||||
self.assertEqual(last_po_id.partner_id, vendor1)
|
||||
self.assertEqual(last_po_id.order_line.price_unit, 60)
|
||||
|
||||
Reference in New Issue
Block a user