[FIX] website_sale_aplicoop: Calculate UoM quantity step server-side for portal users
Portal users cannot read uom.uom model due to ACL restrictions (1,0,0,0 permissions). This caused products sold by weight (kg) to have incorrect quantity step (1 instead of 0.1). Solution: - Calculate quantity_step in Python controller using product.uom_id.sudo() - Check if UoM category contains 'weight' or 'kg' -> use step=0.1 - For other products, use default step=1 - Pass quantity_step to template via product_display_info dict - Update XML input attributes (value, min, step) to use dynamic quantity_step This maintains proper UX for bulk products while respecting security permissions.
This commit is contained in:
parent
ed8c6acd92
commit
f35bf0c5a1
2 changed files with 15 additions and 3 deletions
|
|
@ -1225,6 +1225,10 @@
|
|||
t-set="safe_uom_category"
|
||||
t-value="product_display_info.get(product.id, {}).get('safe_uom_category', '')"
|
||||
/>
|
||||
<t
|
||||
t-set="quantity_step"
|
||||
t-value="product_display_info.get(product.id, {}).get('quantity_step', 1)"
|
||||
/>
|
||||
<t
|
||||
t-set="order_id_safe"
|
||||
t-value="group_order.id if group_order else ''"
|
||||
|
|
@ -1236,6 +1240,7 @@
|
|||
t-attf-data-product-name="{{ product.name }}"
|
||||
t-attf-data-product-price="{{ display_price }}"
|
||||
t-attf-data-uom-category="{{ safe_uom_category }}"
|
||||
t-attf-data-quantity-step="{{ quantity_step }}"
|
||||
>
|
||||
<div class="qty-control">
|
||||
<label
|
||||
|
|
@ -1259,9 +1264,9 @@
|
|||
t-attf-id="qty_{{ product.id }}"
|
||||
class="product-qty"
|
||||
name="quantity"
|
||||
value="1"
|
||||
min="1"
|
||||
step="1"
|
||||
t-attf-value="1"
|
||||
t-attf-min="{{ quantity_step }}"
|
||||
t-attf-step="{{ quantity_step }}"
|
||||
/>
|
||||
<button
|
||||
class="qty-increase"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue