[FIX] website_sale: default company on SO

In multi-company:
- Create 2 companies A and B
- Set the superuser on company B
- Set the website on company A

When a SO is generated from the eCommerce, it is defined on company B,
while it should be on company A.

opw-695253
This commit is contained in:
Nicolas Martinelli
2016-12-29 13:49:28 +01:00
parent 30fb3f7c4c
commit 8a1b55ae04
+3
View File
@@ -326,6 +326,9 @@ class website(orm.Model):
'partner_shipping_id': addr['delivery'],
'user_id': salesperson_id or w.salesperson_id.id,
}
company_id = w.company_id or self.pool['product.pricelist'].browse(cr, SUPERUSER_ID, [pricelist_id], context=context).company_id
if company_id:
values['company_id'] = company_id.id
sale_order_id = sale_order_obj.create(cr, SUPERUSER_ID, values, context=context)
request.session['sale_order_id'] = sale_order_id
sale_order = sale_order_obj.browse(cr, SUPERUSER_ID, sale_order_id, context=context)