[IMP] point_of_sale,pos_*: replace 'save' buttons
Replace save buttons in each module field in pos.config with a message. Saving the pos.config form when a module_ or group_ field is modified will reload the page. closes odoo/odoo#51535 Related: odoo/enterprise#10669 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
committed by
Pierre Masereel
parent
7e06e39c50
commit
18b5efb42d
@@ -0,0 +1,37 @@
|
||||
odoo.define('point_of_sale.pos_config_form', function (require) {
|
||||
'use strict';
|
||||
|
||||
var FormController = require('web.FormController');
|
||||
var FormView = require('web.FormView');
|
||||
var viewRegistry = require('web.view_registry');
|
||||
|
||||
var PosConfigFormController = FormController.extend({
|
||||
_enableButtons: function (changedFields) {
|
||||
let shouldReload = false;
|
||||
for (let field of changedFields) {
|
||||
if (
|
||||
field.startsWith('module_') ||
|
||||
field.startsWith('group_') ||
|
||||
field === 'is_posbox'
|
||||
) {
|
||||
shouldReload = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shouldReload) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
var PosConfigFormView = FormView.extend({
|
||||
config: _.extend({}, FormView.prototype.config, {
|
||||
Controller: PosConfigFormController,
|
||||
}),
|
||||
});
|
||||
|
||||
viewRegistry.add('pos_config_form', PosConfigFormView);
|
||||
return FormView;
|
||||
});
|
||||
@@ -112,6 +112,7 @@
|
||||
<script type="text/javascript" src="/point_of_sale/static/src/js/printers.js"></script>
|
||||
<script type="text/javascript" src="/point_of_sale/static/lib/html2canvas.js"></script>
|
||||
<script type="text/javascript" src="/point_of_sale/static/src/js/debug_manager.js"></script>
|
||||
<script type="text/javascript" src="/point_of_sale/static/src/js/web_overrides/pos_config_form.js"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<field name="name">pos.config.form.view</field>
|
||||
<field name="model">pos.config</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Point of Sale Configuration">
|
||||
<form string="Point of Sale Configuration" js_class="pos_config_form">
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<field name="active" invisible="1"/>
|
||||
@@ -63,7 +63,11 @@
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_pos_restaurant"/>
|
||||
<button string="Save" type="object" name="execute" class="oe_highlight" id="btn_use_pos_restaurant" attrs="{'invisible': [('module_pos_restaurant','=',False)]}" />
|
||||
<div class="content-group" id="warning_text_pos_restaurant" attrs="{'invisible': [('module_pos_restaurant','=',False)]}">
|
||||
<div class="text-warning mt16 mb4">
|
||||
Save this page and come back here to set up the feature.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box"
|
||||
@@ -76,7 +80,11 @@
|
||||
<div class="text-muted">
|
||||
Use employee credentials to log in to the PoS session and switch cashier
|
||||
</div>
|
||||
<button string="Save" type="object" name="execute" class="oe_highlight" id="btn_use_employees" attrs="{'invisible': [('module_pos_hr','=',False)]}" />
|
||||
<div class="content-group" id="warning_text_employees" attrs="{'invisible': [('module_pos_hr','=',False)]}">
|
||||
<div class="text-warning mt16 mb4">
|
||||
Save this page and come back here to set up the feature.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -331,9 +339,9 @@
|
||||
<div class="text-muted">
|
||||
Allow global discounts on orders
|
||||
</div>
|
||||
<div class="content-group " attrs="{'invisible':[('module_pos_discount','=',False)]}">
|
||||
<div class="mt16" id="btn_use_pos_discount">
|
||||
<button string="Save" type="object" name="execute" class="oe_highlight"/>
|
||||
<div class="content-group" id="warning_text_pos_discount" attrs="{'invisible':[('module_pos_discount','=',False)]}">
|
||||
<div class="text-warning mt16 mb4">
|
||||
Save this page and come back here to set up the feature.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -359,8 +367,8 @@
|
||||
Give customer rewards, free samples, etc.
|
||||
</div>
|
||||
<div class="content-group" attrs="{'invisible': [('module_pos_loyalty', '=', False)]}">
|
||||
<div class="mt16" id="btn_use_pos_loyalty">
|
||||
<button string="Save" type="object" name="execute" class="oe_highlight"/>
|
||||
<div class="text-warning mt16 mb4" id="warning_text_pos_loyalty">
|
||||
Save this page and come back here to set up the feature.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">pos.config</field>
|
||||
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<div id="btn_use_pos_discount" position="replace">
|
||||
<div id="warning_text_pos_discount" position="replace">
|
||||
<div class="row mt16">
|
||||
<label string="Discount Product" for="discount_product_id" class="col-lg-3 o_light_label"/>
|
||||
<field name="discount_product_id" attrs="{'required':[('module_pos_discount','=',True)]}"/>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">pos.config</field>
|
||||
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@id='btn_use_employees']" position='replace'>
|
||||
<xpath expr="//div[@id='warning_text_employees']" position='replace'>
|
||||
<div attrs="{'invisible': [('module_pos_hr', '=', False)]}">
|
||||
<span class="o_form_label oe_edit_only">Allowed Employees </span>
|
||||
<field name="employee_ids" widget="many2many_tags"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="model">pos.config</field>
|
||||
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button id="btn_use_pos_restaurant" position="replace"/>
|
||||
<div id="warning_text_pos_restaurant" position="replace"/>
|
||||
<div id="iface_invoicing" position="before">
|
||||
<div class="col-12 col-lg-6 o_setting_box"
|
||||
id="iface_printbill"
|
||||
|
||||
Reference in New Issue
Block a user