From 4ed9442dcb95a87187740dadabfbce925a122064 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Thu, 22 Dec 2011 17:01:04 +0100 Subject: [PATCH] [FIX] sale_crm: fix test in the case where the main company has no sale shop bzr revid: rco@openerp.com-20111222160104-n8xt7qfgfa2c1di5 --- addons/sale_crm/test/sale_crm.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/sale_crm/test/sale_crm.yml b/addons/sale_crm/test/sale_crm.yml index e85cf2cb7ba..8c62b19346b 100644 --- a/addons/sale_crm/test/sale_crm.yml +++ b/addons/sale_crm/test/sale_crm.yml @@ -1,3 +1,16 @@ +- + Make sure the main company has at least one shop. +- + !python {model: sale.shop}: | + company_id = self.pool.get('res.users')._get_company(cr, uid, context=context) + shop_ids = self.search(cr, uid, [('company_id', '=', company_id)]) + if not shop_ids: + # take a shop, and assign it to the user's company + shop_ids = self.search(cr, uid, []) + if shop_ids: + self.write(cr, uid, [shop_ids[0]], {'company_id': company_id}) +- + I open the wizard "Make sales". - !record {model: crm.make.sale, id: crm_make_sale_0}: partner_id: base.res_partner_4