[IMP] point_of_sale: add setting for manual discount.
Add an option in the pos config to disallow the use of manual discount per order line. closes odoo/odoo#51172 Task-id: 2082140 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
committed by
Pierre Masereel
parent
0fd287badd
commit
5cb25d43eb
@@ -218,6 +218,7 @@ class PosConfig(models.Model):
|
||||
only_round_cash_method = fields.Boolean(string="Only apply rounding on cash")
|
||||
has_active_session = fields.Boolean(compute='_compute_current_session')
|
||||
show_allow_invoicing_alert = fields.Boolean(compute="_compute_show_allow_invoicing_alert")
|
||||
manual_discount = fields.Boolean(string="Manual Discounts", default=True)
|
||||
|
||||
@api.depends('use_pricelist', 'available_pricelist_ids')
|
||||
def _compute_allowed_pricelist_ids(self):
|
||||
@@ -634,7 +635,7 @@ class PosConfig(models.Model):
|
||||
def setup_defaults(self, company):
|
||||
"""Extend this method to customize the existing pos.config of the company during the installation
|
||||
of a localisation.
|
||||
|
||||
|
||||
:param self pos.config: pos.config records present in the company during the installation of localisation.
|
||||
:param company res.company: the single company where the pos.config defaults will be setup.
|
||||
"""
|
||||
|
||||
@@ -28,10 +28,16 @@ odoo.define('point_of_sale.NumpadWidget', function(require) {
|
||||
const cashier = this.env.pos.get('cashier') || this.env.pos.get_cashier();
|
||||
return !this.env.pos.config.restrict_price_control || cashier.role == 'manager';
|
||||
}
|
||||
get hasManualDiscount() {
|
||||
return this.env.pos.config.manual_discount;
|
||||
}
|
||||
changeMode(mode) {
|
||||
if (!this.hasPriceControlRights && mode === 'price') {
|
||||
return;
|
||||
}
|
||||
if (!this.hasManualDiscount && mode === 'discount') {
|
||||
return;
|
||||
}
|
||||
this.state.mode = mode;
|
||||
this.trigger('set-numpad-mode', { mode });
|
||||
}
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
<button class="input-button number-char" t-on-click="sendInput('4')">4</button>
|
||||
<button class="input-button number-char" t-on-click="sendInput('5')">5</button>
|
||||
<button class="input-button number-char" t-on-click="sendInput('6')">6</button>
|
||||
<button class="mode-button" t-att-class="{'selected-mode': state.mode === 'discount'}"
|
||||
<button class="mode-button" t-att-class="{
|
||||
'selected-mode': state.mode === 'discount',
|
||||
'disabled-mode': !hasManualDiscount
|
||||
}"
|
||||
t-att-disabled="!hasManualDiscount"
|
||||
t-on-click="changeMode('discount')">Disc</button>
|
||||
<br />
|
||||
<button class="input-button number-char" t-on-click="sendInput('7')">7</button>
|
||||
|
||||
@@ -93,6 +93,7 @@ odoo.define('point_of_sale.tests.ProductScreen', function (require) {
|
||||
// set dummy values in pos.config and pos.get('cashier')
|
||||
pos.config = {
|
||||
restrict_price_control: false,
|
||||
manual_discount: true
|
||||
};
|
||||
pos.set('cashier', { role: 'manager' });
|
||||
|
||||
|
||||
@@ -328,6 +328,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-lg-6 o_setting_box" >
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="manual_discount"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="manual_discount"/>
|
||||
<div class="text-muted">
|
||||
Allow discounts per line
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_loyalty" widget="upgrade_boolean" nolabel="1"/>
|
||||
|
||||
Reference in New Issue
Block a user