From 2794fee11011730f85f8a8aa8e53d6c151e82491 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Thu, 10 Dec 2020 10:40:47 +0000 Subject: [PATCH] [IMP] stock: adds price on stock move This commit adds some value on incoming stock moves created by the `populate` generation. This makes transfers more realistic and allow creating stock valuation if accounting is installed as well. closes odoo/odoo#63139 Signed-off-by: William Henrotin --- addons/stock/populate/stock.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/stock/populate/stock.py b/addons/stock/populate/stock.py index d60ea9a5497..9aebd0ce77c 100644 --- a/addons/stock/populate/stock.py +++ b/addons/stock/populate/stock.py @@ -526,6 +526,7 @@ class StockMove(models.Model): yield values def _compute_picking_values(iterator, field_name, model_name): + random = populate.Random('_compute_picking_values') for values in iterator: if values.get('picking_id'): picking = self.env['stock.picking'].browse(values['picking_id']) @@ -535,6 +536,8 @@ class StockMove(models.Model): values['name'] = picking.name values['date'] = picking.scheduled_date values['company_id'] = picking.company_id.id + if picking.picking_type_id.code == 'incoming': + values['price_unit'] = random.randint(1, 100) yield values return [