Add min max inputs to shop
This commit is contained in:
parent
5bb3fd5f06
commit
3b28ac0205
5 changed files with 40 additions and 9 deletions
|
|
@ -5,7 +5,10 @@
|
||||||
"website": "https://www.bakeup.org",
|
"website": "https://www.bakeup.org",
|
||||||
"category": "Stock",
|
"category": "Stock",
|
||||||
"version": "16.0.0.0.1",
|
"version": "16.0.0.0.1",
|
||||||
"depends": ["stock"],
|
"depends": ["sale_management", "website_sale"],
|
||||||
"data": ["views/sale_order_views.xml"],
|
"data": [
|
||||||
|
"views/sale_order_views.xml",
|
||||||
|
'views/templates.xml',
|
||||||
|
],
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
from . import sale_order_line
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
from odoo import models
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
class SaleOrderLine(models.Model):
|
class SaleOrderLine(models.Model):
|
||||||
_inherit = "sale.order.line"
|
_inherit = "sale.order.line"
|
||||||
|
|
||||||
|
product_uom_min_qty = fields.Float(string="Max quantity", digits="Product Unit of Measure")
|
||||||
|
product_uom_max_qty = fields.Float(string="Min quantity", digits="Product Unit of Measure")
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
<field name="model">sale.order</field>
|
<field name="model">sale.order</field>
|
||||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="before">
|
||||||
|
<field name="product_uom_max_qty"/>
|
||||||
|
<field name="product_uom_min_qty"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
20
nfu_sale_product_min_max_qty/views/templates.xml
Normal file
20
nfu_sale_product_min_max_qty/views/templates.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<template id="product_quantity_min_max" inherit_id="website_sale.product" name="Select Quantity">
|
||||||
|
<xpath expr="//div[@id='o_wsale_cta_wrapper']/div/a[1]" position="before">
|
||||||
|
<span class="input-group-text">Min</span>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//div[@id='add_to_cart_wrap']" position="before">
|
||||||
|
<div t-attf-class="css_quantity input-group {{'d-none' if combination_info['prevent_zero_price_sale'] else 'd-inline-flex'}} me-2 mb-2 align-middle #{'input-group-lg' if ctaSizeBig else ''}" contenteditable="false">
|
||||||
|
<span class="input-group-text">Max</span>
|
||||||
|
<a t-attf-href="#" class="btn btn-link js_add_cart_json" aria-label="Remove one" title="Remove one">
|
||||||
|
<i class="fa fa-minus"></i>
|
||||||
|
</a>
|
||||||
|
<input type="text" class="form-control quantity text-center" data-min="1" name="max_qty" t-att-value="max_qty or 1"/>
|
||||||
|
<a t-attf-href="#" class="btn btn-link float_left js_add_cart_json" aria-label="Add one" title="Add one">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in a new issue