[FIX] website_sale: don't rewrite sale order partner_id with the public user
bzr revid: chm@openerp.com-20140505124702-cq6tvb6h3lgyst99
This commit is contained in:
@@ -369,7 +369,7 @@ class website_sale(http.Controller):
|
|||||||
|
|
||||||
orm_partner = registry.get('res.partner')
|
orm_partner = registry.get('res.partner')
|
||||||
orm_user = registry.get('res.users')
|
orm_user = registry.get('res.users')
|
||||||
order_line_obj = request.registry.get('sale.order')
|
order_obj = request.registry.get('sale.order')
|
||||||
|
|
||||||
billing_info = self.checkout_parse('billing', checkout, True)
|
billing_info = self.checkout_parse('billing', checkout, True)
|
||||||
|
|
||||||
@@ -406,7 +406,7 @@ class website_sale(http.Controller):
|
|||||||
order_info.update(registry.get('sale.order').onchange_partner_id(cr, SUPERUSER_ID, [], partner_id, context=context)['value'])
|
order_info.update(registry.get('sale.order').onchange_partner_id(cr, SUPERUSER_ID, [], partner_id, context=context)['value'])
|
||||||
order_info.pop('user_id')
|
order_info.pop('user_id')
|
||||||
|
|
||||||
order_line_obj.write(cr, SUPERUSER_ID, [order.id], order_info, context=context)
|
order_obj.write(cr, SUPERUSER_ID, [order.id], order_info, context=context)
|
||||||
|
|
||||||
@http.route(['/shop/checkout'], type='http', auth="public", website=True, multilang=True)
|
@http.route(['/shop/checkout'], type='http', auth="public", website=True, multilang=True)
|
||||||
def checkout(self, **post):
|
def checkout(self, **post):
|
||||||
@@ -521,6 +521,8 @@ class website_sale(http.Controller):
|
|||||||
if not order or not order.order_line or acquirer_id is None:
|
if not order or not order.order_line or acquirer_id is None:
|
||||||
return request.redirect("/shop/checkout")
|
return request.redirect("/shop/checkout")
|
||||||
|
|
||||||
|
assert order.partner_id.id != request.website.partner_id.id
|
||||||
|
|
||||||
# find an already existing transaction
|
# find an already existing transaction
|
||||||
tx = request.website.sale_get_transaction()
|
tx = request.website.sale_get_transaction()
|
||||||
if not tx:
|
if not tx:
|
||||||
@@ -530,6 +532,7 @@ class website_sale(http.Controller):
|
|||||||
'amount': order.amount_total,
|
'amount': order.amount_total,
|
||||||
'currency_id': order.pricelist_id.currency_id.id,
|
'currency_id': order.pricelist_id.currency_id.id,
|
||||||
'partner_id': order.partner_id.id,
|
'partner_id': order.partner_id.id,
|
||||||
|
'partner_country_id': order.partner_id.country_id.id,
|
||||||
'reference': order.name,
|
'reference': order.name,
|
||||||
'sale_order_id': order.id,
|
'sale_order_id': order.id,
|
||||||
}, context=context)
|
}, context=context)
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class website(orm.Model):
|
|||||||
request.session['sale_order_code_pricelist_id'] = False
|
request.session['sale_order_code_pricelist_id'] = False
|
||||||
|
|
||||||
# check for change of partner_id ie after signup
|
# check for change of partner_id ie after signup
|
||||||
if sale_order.partner_id.id != partner.id:
|
if sale_order.partner_id.id != partner.id and request.website.partner_id.id != partner.id:
|
||||||
flag_pricelist = False
|
flag_pricelist = False
|
||||||
pricelist_id = request.session.get('sale_order_code_pricelist_id') or partner.property_product_pricelist.id
|
pricelist_id = request.session.get('sale_order_code_pricelist_id') or partner.property_product_pricelist.id
|
||||||
if pricelist_id != sale_order.pricelist_id.id:
|
if pricelist_id != sale_order.pricelist_id.id:
|
||||||
@@ -187,6 +187,10 @@ class website(orm.Model):
|
|||||||
if flag_pricelist or values.get('fiscal_position') != fiscal_position:
|
if flag_pricelist or values.get('fiscal_position') != fiscal_position:
|
||||||
update_pricelist(pricelist_id)
|
update_pricelist(pricelist_id)
|
||||||
|
|
||||||
|
# update browse record
|
||||||
|
if (code and code != sale_order.pricelist_id.code) or sale_order.partner_id.id != partner.id:
|
||||||
|
sale_order = sale_order_obj.browse(cr, SUPERUSER_ID, sale_order.id, context=context)
|
||||||
|
|
||||||
return sale_order
|
return sale_order
|
||||||
|
|
||||||
def sale_get_transaction(self, cr, uid, ids, context=None):
|
def sale_get_transaction(self, cr, uid, ids, context=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user