[IMP] point_of_sale: Add the possiblity to enable auto validate order

Actually if the customer pay with a electronic payment method the order
is automatically validated.

With this commit we add the possibility to activate or not this functionality

closes odoo/odoo#103569

Signed-off-by: Masereel Pierre <pim@odoo.com>
This commit is contained in:
lejeune quentin
2022-10-20 11:18:45 +02:00
parent 3f12de691b
commit e032acc44e
4 changed files with 15 additions and 1 deletions
@@ -173,6 +173,7 @@ class PosConfig(models.Model):
"In the meantime, you can use the 'Load Customers' button to load partners from database.")
limited_partners_amount = fields.Integer(default=100)
partner_load_background = fields.Boolean(default=True)
auto_validate_terminal_payment = fields.Boolean(default=True, help="Automatically validates orders paid with a payment terminal.")
@api.depends('payment_method_ids')
def _compute_cash_control(self):
@@ -100,6 +100,7 @@ class ResConfigSettings(models.TransientModel):
pos_use_pricelist = fields.Boolean(related='pos_config_id.use_pricelist', readonly=False)
pos_warehouse_id = fields.Many2one(related='pos_config_id.warehouse_id', readonly=False, string="Warehouse (PoS)")
point_of_sale_use_ticket_qr_code = fields.Boolean(related='company_id.point_of_sale_use_ticket_qr_code', readonly=False)
pos_auto_validate_terminal_payment = fields.Boolean(related='pos_config_id.auto_validate_terminal_payment', readonly=False, string="Automatically validates orders paid with a payment terminal.")
@api.model_create_multi
def create(self, vals_list):
@@ -396,7 +396,8 @@ odoo.define('point_of_sale.PaymentScreen', function (require) {
// the current order is fully paid and due is zero.
if (
this.currentOrder.is_paid() &&
utils.float_is_zero(this.currentOrder.get_due(), this.env.pos.currency.decimal_places)
utils.float_is_zero(this.currentOrder.get_due(), this.env.pos.currency.decimal_places) &&
this.env.pos.config.auto_validate_terminal_payment
) {
this.trigger('validate-order');
}
@@ -397,6 +397,17 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="pos_auto_validate_terminal_payment"/>
</div>
<div class="o_setting_right_pane">
<label for="pos_auto_validate_terminal_payment" string="Automatically validate order" />
<div class="text-muted">
Automatically validates orders paid with a payment terminal.
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="pos_cash_rounding"/>