[FIX] website_sale: better address management portal
Before this commit, when editing the shipping id of a partner having a company_id, an Error 500 was thrown because of recursive hierarchies. On top of that, since no employees should be able to modify its company's address, we hide the dit button in that case BUT we display addresses type=other (the one that a child of a company has anyway) meaning that the billing address appears also as a shipping one. OPW 782524
This commit is contained in:
@@ -425,7 +425,7 @@ class WebsiteSale(http.Controller):
|
||||
Partner = order.partner_id.with_context(show_address=1).sudo()
|
||||
shippings = Partner.search([
|
||||
("id", "child_of", order.partner_id.commercial_partner_id.ids),
|
||||
'|', ("type", "=", "delivery"), ("id", "=", order.partner_id.commercial_partner_id.id)
|
||||
'|', ("type", "in", ["delivery", "other"]), ("id", "=", order.partner_id.commercial_partner_id.id)
|
||||
], order='id desc')
|
||||
if shippings:
|
||||
if kw.get('partner_id') or 'use_billing' in kw:
|
||||
|
||||
@@ -1089,6 +1089,7 @@
|
||||
<t t-foreach="shippings" t-as="ship">
|
||||
<div class="col-sm-12 col-md-6 one_kanban">
|
||||
<t t-call="website_sale.address_kanban">
|
||||
<t t-set="actual_partner" t-value="order.partner_id" />
|
||||
<t t-set='contact' t-value="ship"/>
|
||||
<t t-set='selected' t-value="order.partner_shipping_id==ship"/>
|
||||
<t t-set='readonly' t-value="bool(len(shippings)==1)"/>
|
||||
@@ -1122,7 +1123,7 @@
|
||||
</t>
|
||||
<input type='submit'/>
|
||||
</form>
|
||||
<a class='btn btn-link pull-right fa fa-edit js_edit_address no-decoration' title="Edit this address"></a>
|
||||
<a t-if="not actual_partner or (ship.id in actual_partner.ids + actual_partner.child_ids.ids)" class='btn btn-link pull-right fa fa-edit js_edit_address no-decoration' title="Edit this address"></a>
|
||||
<div t-att-class="'panel panel-default %s' % (selected and 'border_primary' or 'js_change_shipping')">
|
||||
<div class='panel-body' style='min-height: 130px;'>
|
||||
<t t-esc="contact" t-options="dict(widget='contact', fields=['name', 'address'], no_marker=True)"/>
|
||||
|
||||
Reference in New Issue
Block a user